match语句咨询

应该是没有 RETURN 子句导致
把第二个 WITH 改成 RETURN 试试

我自己解决了

话说是啥问题?不是 return 的问题?

这样写的

MATCH (p:Person), (friend:Person {firstName: ‘Ian’ })
WHERE NOT p==friend AND id(p)==‘person30786325579101’
WITH p, friend
MATCH paths = shortestPath((p)-[:PersonKnowsPerson*1…3]-(friend))
WITH min(length(paths)) AS distance, friend
LIMIT 20

         MATCH (friend)-[:PersonIsLocatedInPlace]->(friendCity:Place)
         OPTIONAL MATCH (friend)-[studyAt:PersonStudyAtOrganisation]->(uni:Organisation)-[:OrganisationIsLocatedInPlace]->(uniCity:Place)
         WITH friend, collect(
             CASE uni.name
                 WHEN null THEN null
                 ELSE [uni.name, studyAt.classYear, uniCity.name]
             END ) AS unis, friendCity, distance

         OPTIONAL MATCH (friend)-[workAt:PersonWorkAtOrganisation]->(company:Organisation)-[:OrganisationIsLocatedInPlace]->(companyCountry:Place)
         WITH friend, collect(
             CASE company.name
                 WHEN null THEN null
                 ELSE [company.name, workAt.workFrom, companyCountry.name]
             END ) AS companies, unis, friendCity, distance

         RETURN
             id(friend) AS friendId,
             friend.Person.lastName AS friendLastName,
             distance AS distanceFromPerson,
             friend.Person.birthday AS friendBirthday,
             friend.Person.creationDate AS friendCreationDate,
             friend.Person.gender AS friendGender,
             friend.Person.browserUsed AS friendBrowserUsed,
             friend.Person.locationIP AS friendLocationIp,
             friend.Person.email AS friendEmails,
             friend.Person.language AS friendLanguages,
             friendCity.Place.name AS friendCityName
         ORDER BY
             friendLastName ASC
         LIMIT 3;

此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。