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.

Hello @georg_kf_heiler :slight_smile:

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

Regards,
Cobra

1 Like