cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How can I display a list of couples

I am working on a query which has to display a list which contains nodes which worked together and count the number of their appearance , I wrote this query but I am getting a list of nodes which are working with the same Contract :
2X_b_bc18d1d2aa1b78abbd9902fa73fa23c49b1bde86.png

6 REPLIES 6

Benoit
Graph Buddy

Hi,

Without the query, a description of your model (for example a screenshot of your graph from the browser), and the result you want, it will hard to help you.

Can you update your question with those information ?

Thanks

I hope this picture made it much better to get what I mean 2X_b_b6052677a741c2971a55d820d60d5835556b743c.jpeg

It's better but still not enought.
What do you mean by :

And can you share the query you have done so far ?

in my example , I mean that I want to display a list in which there are each two "Att" or more which worked with the same Contract and in the other row the number of times that those "Att" worked together . Here is my query :

MATCH (contrat:Contrat)-[r:ASSIGNED]->(at:Attrib)
WITH DISTINCT (contrat.cpv) AS a,
collect  (at.label) as b,
count (contrat) as c 
RETURN DISTINCT  (b),c,a
ORDER by c desc

Hi,

Try this query:

MATCH p = (contrat:Contrat)-[r:ASSIGNED]->(at:Attrib)
WITH at, count(p) as Cnt
RETURN Cnt, COLLECT(at.label) as Attrib ORDER BY Cnt desc;

This should show the 'Result' in your picture. From your picture I recreated the database and tested the above query .

Hope this will help you.
-Kamal

Thanks man it works 🙂