Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-10-2020 05:49 AM
Hi,
I am working with a 3.3.5 community edition of Neo4j.
I would like to display one property out of many in a node.
The following query displays all the properties (tagline, title, released) of the node Movie.
match(p:Movie) WHERE p.released=2004 and p.title contains 'Polar' unwind keys(p) as key return key as keyname, p[key] as value;
Is it possible to display only one property with its keys and values (title for example) like this ?
keyname value
title The Polar Express
Thank you.
Jean-michel, Nemours, France
03-10-2020 08:57 AM
Hello @alzingrejm1,
Instead of using the keys() function, have you tried to just return the property by name?
Something like this:
MATCH (p:Movie)
WHERE p.released=2004
AND p.title contains 'Polar'
RETURN p.title;
-yyyguy
03-11-2020 05:34 AM
Hi yyyguy,
Thank you. Yes it works.
MATCH (p:Movie)
WHERE p.released=2004
AND p.title contains 'Polar'
RETURN distinct p.released, p.title;
│"p.released"│"p.title" │
╞════════════╪═══════════════════╡
│2004 │"The Polar Express"
I am going to test this on production.
Jean-michel
03-11-2020 06:55 AM
Hi yyyguy,
Following your idea, I managed to get what I need through the following query
match(p:) ... return 'NAME' as key, p.NAME as value;
This way, I get only one line with two columns.
Thank you.
Jean-michel
All the sessions of the conference are now available online