我正在尝试组合两种类型的查询并使用COLLECT返回一个结果集来创建匹配的列名称,但它仍然给我“UNION”中的所有子查询必须具有相同的专栏名称'错误。有没有办法做到这一点:
MATCH(i:Person{username:"wkolcz"})
MATCH(p:Person)-[]->(m:Meetup{status:"Accepted"})<-[]-(i),
(m)-[:MEETUP_AT]->(l:Location)
WHERE toInt(m.meet_date) >= 1446302204
RETURN COLLECT({name:p.first_name + " " + p.last_name,image_name: p.image_name, username:p.username,meeting_id:id(m) , meet_date:m.meet_date,
location_name:l.location_name, address:l.address, city:l.city, state:l.state, zip_code:l.zip_code,type:"person"})
UNION ALL
MATCH(g:Group)-[:CREATED]->(gm:Meetup{status:"Active"})<-[:ATTENDING]-(i),
(gm)-[:MEETUP_AT]->(gl:Location)
WHERE toInt(gm.meet_date) >= 1446302204
RETURN COLLECT({name:g.group_name,image_name: g.image_name, username:g.group_slug,meeting_id:id(gm) , meet_date:gm.meet_date,
location_name:gl.location_name, address:gl.address, city:gl.city, state:gl.state, zip_code:gl.zip_code,type:"group"})
答案 0 :(得分:3)
将列名称替换为同一个名称。
RETURN COLLECT(...) AS data
UNION ALL
RETURN COLLECT(...) AS data