Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-17-2021 12:35 PM
I hope you may help me:
I need to build a table with 4 columns but the columns 3 and 4 are filled with two different queries:
MATCH (u:UserNode)-[:PROMOTER_OF*1..]->(c:UserNode)
WHERE u.promoterActualRole IN ["GOLD","RUBY","SAPPHIRE","BRONZE","EMERALD", "DIAMOND"]
AND datetime(c.promoterStartActivity) >= datetime("2021-02-01T00:00:00Z")
AND datetime(c.promoterStartActivity)<= datetime("2021-05-31T23:59:59Z")
AND c.promoterEnabled = true
AND u.firstName="Gianvito"
WITH distinct u as user, count(c) as num_promoter
WHERE num_promoter >= 150
RETURN user.firstName as name, user.email as email, num_promoter, null as num_swaggy
and
MATCH (u:UserNode)-[:PROMOTER_OF*1..]->(c:UserNode)
WHERE u.promoterActualRole IN ["GOLD","RUBY","SAPPHIRE","BRONZE","EMERALD", "DIAMOND"]
AND datetime(c.subscriptionDate) >= datetime("2021-02-01T00:00:00Z")
AND datetime(c.subscriptionDate)<= datetime("2021-05-31T23:59:59Z")
AND c.kycStatus = "OK"
AND u.firstName="Gianvito"
WITH distinct u as user, count(c) as num_swaggy
WHERE num_swaggy >= 1
RETURN user.firstName as name, user.email as email ,null as num_promoter, num_swaggy
My first guess was to make a Union but if I do so what I get is two rows like this
name | num_promoter | num_swaggy | |
---|---|---|---|
Gianvito | gianvito@email.com | 1475 | null |
Gianvito | gianvito@email.com | null | 1820 |
while I want to get this
name | num_promoter | num_swaggy | |
---|---|---|---|
Gianvito | gianvito@email.com | 1475 | 1820 |
All the sessions of the conference are now available online