match (a:Person)-[role:ACTED_IN]->(m:Movie)
with m, max(role.earnings) as earnings
match (a:Person)-[:ACTED_IN{earnings:earnings]->(m)
return m.title as Movie, earnings, a.name as actor
排序并选取集合中的第一项:
match (a:Person)-[role:ACTED_IN]->(m:Movie)
with m, role.earnings as earnings, a.name as actor order by earnings
return m.title as Movie, collect(earnings)[0] as earnings, collect(actor)[0] as actor
MATCH (a:Person)-[role:ACTED_IN]->(m:Movie)
WITH m, role.earnings as earnings, a ORDER BY earnings DESC
RETURN m.title as Movie, collect(earnings)[0] as earnings, collect(a.name)[0] as actor
2条答案
按热度按时间rekjcdws1#
这里有两种选择。
再次匹配并查找具有最大收入的演员:
排序并选取集合中的第一项:
需要考虑的其他一些问题:
eblbsuwk2#
你可以按收入降序对电影、收入和演员进行排序/收集。然后获取集合中的第一项。