Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-03-2022 02:01 PM
I am trying to select all nodes that have a relationship with a specific property but return only those with redundant property values. For example:
MATCH (:Node)-[a:Send{Flag: 'A'}]->(m:Node)
RETURN [m.Name, a.Port] AS output
It returns
["Device A", 22]
["Device A", 22]
["Device A", 22]
["Device A", 93]
["Device A", 93]
["Device A", 554]
["Device A", 445]
I want the output to be
["Device A", 22, 3]
["Device A", 93, 2]
06-03-2022 02:25 PM
Hello @nboubakr 🙂
MATCH (:Node)-[a:Send {Flag: 'A'}]->(m:Node)
WITH m.Name AS name, a.Port AS port, count(*) AS occurrences
WHERE occurrences > 1
RETURN [name, port, occurrences] AS output
Regards,
Cobra
06-04-2022 08:30 PM
Try this:
WITH distinct a.port as Port, m.name as Name, count(distinct m.name) as NameCount
RETURN Name, Port, NameCount order by Name
All the sessions of the conference are now available online