Создать пример базы данных
CREATE
(a:USER { id:1 } ),
(b:USER { id:2 } ),
(c:PLACE { id:1 } ),
(a)-[:RATE {createdAt: localdatetime("2018-12-20T12:34:00"), rating:5 }]->(c),
(a)-[:RATE {createdAt: localdatetime("2018-12-21T12:34:00"), rating:9 }]->(c),
(b)-[:RATE {createdAt: localdatetime("2018-12-20T12:34:00"), rating:8 }]->(c),
(b)-[:RATE {createdAt: localdatetime("2018-12-21T12:34:00"), rating:7 }]->(c);
Запрос (Этот запрос основан на этом ответе)
MATCH (a:USER)-[r:RATE]->(:PLACE)
WITH a, r
ORDER BY a.id DESC
WITH a, collect(r) AS ratings
WITH a, last(ratings) AS rating
RETURN a.id AS user, endNode(rating).id as place, rating.createdAt AS time;
Результат
user place time
1 1 2018-12-21T12:34:00
2 1 2018-12-21T12:34:00