问题
This question is a follow on to the question here
With 2 answers for that
Now I need to modify this query to return those items related to this HashTag
, order by createdDate
(as all those items have createdDate
property).
I've written this query:
MATCH (r:RateableEntity)<-[:TAG]-(h:HashTag:Featured)
WITH h, COUNT(h) AS Count
ORDER BY Count DESC
SKIP 2
LIMIT 3
WITH h, Count, h.tag as Name,
[(h)-[:TAG]->(m:RateableEntity {audience: 'world'}) | m][..3] AS Items
UNWIND Items as row
RETURN row, Name, Count, COLLECT(row.id)
ORDER BY row.createdDate
But the results are:
Name row.id Count
"vanessa" "cdd14968-404c-41e9-84d5-bf147030a023" 14
"vanessa" "qwd14968-2344-41e9-84d5-bftt34534566" 14
"vanessa" "cd14968-404c-41e9-84d5-certt4545455g" 14
"hash" "b7e74f38-44e4-4b7f-b2c4-8301023ffa9b" 15
"hash" "edr34334-2995-4202-b178-bb2a6f230ab0" 15
"hash" "htth5548-404c-41e9-84d5-bf147030a023" 15
"new" "oljj4968-2344-41e9-84d5-bftt34534566" 3
"new" "werr4968-404c-41e9-84d5-certt4545455" 3
"new" "be545b38-44e4-4b7f-b2c4-8301023ffa9b" 3
I can see that count is correct and
skip and limit
working as I want but here I have 3 rows instead of one row and 3 id
.
Also ORDER BY
is not working.
Any idea? ideas appreciated.
UPDATE:
Actually the result of this query will be nodes and after that, in my code, I'm mapping to this, so still it's not what I want
来源:https://stackoverflow.com/questions/55447197/order-by-results-per-row-in-cypher-queryneo4j