Hello
Suppose I have the following query:
MATCH(b:A)
WITH b.field1 as field1, MAX(b.field2) as field2
WHERE b.field1 = field1
MATCH (b)
WHERE b.field1 = field1 AND b.field2 = field2
RETURN b
This query works fine and returns the data I want but the ...
Suppose I have the following data:
field1, field2
1,1
1,4
1,3
2,5
2,2
3,1
3,8
3,9
3,11
4,4
How can I write a cypher query to return the node that has the biggest value of field2 for a given field1 . i.e.
1,4
2,5
3,11
4,4
My attempts so far hav...
Turns out the query to achieve this is rather simple:
MATCH(b:A)
WITH b.field1 as field1, MAX(b.field2) as field2
WHERE b.field1 = field1
MATCH (b)
WHERE b.field1 = field1 AND b.field2 = field2
RETURN b