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.

Distinct Union of attributes

Using the default movie graph I want to query for something along the lines of:

MATCH (n:Movie)
RETURN DISTINCT n.tagline UNION n.title
LIMIT 25
;

I want to obtain a DISTINCT list of all the strings from the attributes tagline and title (not their combinations) but i.e. assuming there was a tagline foo and a title foo the output would only contain foo once.

1 ACCEPTED SOLUTION

Hello @georg.kf.heiler

MATCH (n:Movie)
CALL {
    WITH n
    RETURN n.tagline AS string
    UNION ALL
    WITH n
    RETURN n.title AS string
}
RETURN string

Regards,
Cobra

View solution in original post

1 REPLY 1

Hello @georg.kf.heiler

MATCH (n:Movie)
CALL {
    WITH n
    RETURN n.tagline AS string
    UNION ALL
    WITH n
    RETURN n.title AS string
}
RETURN string

Regards,
Cobra