My simple database contains nodes of 'terms' and 'codes' linked to each other. There are two types of relationships.
Relationships between 'terms' and 'codes' called :CODE and are undirected (or read in both directions equally). Relationships between 'terms' called :NT (which means narrow term) and are directed.
I want to get the list of all terms which are connected by :NT relationships and have equal codes. This is pretty simple query in SQL Server but next I want to extend by all :NT* relationships. That's why I'm using Neo4j.
If I run the query below it is OK, except many duplicate rows.
MATCH (a)-[:NT]->(b), (a)-[:CODE]-(c), (b)-[:CODE]-(c)
RETURN DISTINCT a.termid AS termid, c.code AS code
UNION ALL
MATCH (a)-[:NT]->(b), (a)-[:CODE]-(c), (b)-[:CODE]-(c)
RETURN DISTINCT b.termid AS termid, c.code AS code
ORDER BY termid;
I want to remove duplicate rows in the result set.
This is absolutely same action as Data->Remove Duplicates in MS Excel.
I can not implement it in Neo4j that easy.
Thank you for your help!