neo4j 怎样实现分组查询
请问,谁知道:neo4j 怎样实现分组查询,每组返回前10个?
6 回复
根据不同的条件查询 并返回么?
这种么
with [1,2,3,4,5,6] as list
unwind list as li
call apoc.case(
[li=1 or li=2,"MATCH (n:Partner) RETURN n LIMIT 10"
,li=3,"MATCH (n:Name) RETURN n LIMIT 10"]
,"MATCH (n:ShareHolder) RETURN n LIMIT 10",null) yield value
return value
可以先压到排序的集合/列表里,然后取前N个: MATCH … … WITH group1, group2, collect(data1)[0…9] AS col1, collect(data2)[0…9] AS col2 ORDER BY group1, group2 WITH group1, group2, col1, col2, range(0,9) AS iterator UNWIND iterator AS i RETURH group1, group2, col1[i], col2[i]