Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-26-2022 03:42 AM
I am a newcomer to Neo4J but have been making good progress. I need some help with this one though.
The following query is supposed to return me 2 independent counts in a single query but returns pcount=0 and gcount=0 when I am looking for pcount=1 and gcount=0.
If I run each "half" of the query individually, I get the correct results.
// Person
Solved! Go to Solution.
10-26-2022 12:54 PM
Try this:
call{
MATCH (p:Person)
WHERE p.lat > -90
AND EXISTS {
(p)-[:SKILL]-(skill:Skill)
WHERE skill.skillId IN ['instrument_accompanist']
}
RETURN 'person' as type, count(p) as count
UNION ALL
MATCH (g:Gig)
WHERE g.lat > -90
AND EXISTS {
(g)-[:SKILL]-(skill:Skill)
WHERE skill.skillId IN ['instrument_accompanist']
}
RETURN 'gig' as type, count(g) as count
}
return type, count
10-26-2022 12:54 PM
Try this:
call{
MATCH (p:Person)
WHERE p.lat > -90
AND EXISTS {
(p)-[:SKILL]-(skill:Skill)
WHERE skill.skillId IN ['instrument_accompanist']
}
RETURN 'person' as type, count(p) as count
UNION ALL
MATCH (g:Gig)
WHERE g.lat > -90
AND EXISTS {
(g)-[:SKILL]-(skill:Skill)
WHERE skill.skillId IN ['instrument_accompanist']
}
RETURN 'gig' as type, count(g) as count
}
return type, count
10-26-2022 10:04 PM
Thanks a lot for this - much appreciated. Will try out asap.
I really love Neo4J but Cypher can be a real ballache. I have not learned Neo4J systematically (as I know I should have) but I can't help wondering if it isn't possible to make it semantically more approachable for many usual use cases.
10-27-2022 09:19 AM
I felt overwhelmed at first. I plowed along reading the cypher manual over and over and trying a lot of the features. I also suggest you take the graph academy classes on cypher.
All the sessions of the conference are now available online