0

我可以在 count() 中添加条件吗?让我解释。

START me=node:node_auto_index(UserProfileID = '1'), other=node(*) 
MATCH pMutualFriends=me-[r?:friends]-mf-[r1:friends]-other 
WHERE other.UserName? =~ '(?i)dh.*' AND other.UserProfileID? <> 1 
RETURN me.EMailID, other.EMailID,other.UserProfileID, other.UserName, r.ApprovalStatus,    COUNT(pMutualFriends) AS mutualCount

在上面的查询中,我可以这样使用吗?

COUNT(pMutualFriends where r.ApprovalStatus = 1 AND r1.ApprovalStatus =1 )

或者可能是其他方式?

谢谢

4

1 回答 1

2

filter功能应该可以帮助您。如果您需要进一步的帮助,请在http://console.neo4j.org上提供数据样本并在此处分享。

举个例子:

START me=node:node_auto_index(UserProfileID = '1'), other=node(*) 
MATCH pMutualFriends=me-[r?:friends]-mf-[r1:friends]-other 
WHERE other.UserName? =~ '(?i)dh.*' AND other.UserProfileID? <> 1 
RETURN me.EMailID, other.EMailID,other.UserProfileID, other.UserName, 
  count(filter(x IN r.ApprovalStatus: x=1)), 
  count(filter(x IN r1.ApprovalStatus: x=1))
于 2013-08-12T09:59:26.143 回答