我有一个亲戚:
Keyword - PAID_BY -> App
在这里,我想按应用程序查找共有的关键字。
示例:
KW1 PAID_BY App1
KW2 PAID_BY App1
KW1 PAID_PY App2
KW1 PAID_PY App3
KW2 PAID_PY App3
当我尝试查找App1与其他应用程序的共同关键字时,我应该会找到如下结果:
KW1 is mutual keyword between App1 and App2
and KW1 and KW2 is mutual keyword between App1 and App3
下面是我的密码查询:
MATCH a1:App{id:$idSource} <- PAID_BY - k:Keyword - PAID_BY -> a2:App
RETURN a1,
a2,
COUNT(DISTINCT k) AS mutualKeywordCount,
COLLECT(DISTINCT k) AS mutualKeywords
我试过了,但效果不明显。有什么建议吗?
它应该作为App1的输入:
App1 App2 1 KW1
App1 App3 2 KW1,KW2
但看起来:
App1 App2 1 KW1
App1 App3 2 KW1,KW2
App1 App3 2 KW1,KW2
1条答案
按热度按时间emeijp431#
DISTINCT也可以用在RETURN中。请尝试: