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 to split query result

Hi,

When I run the querry like MATCH (a) RETURN a
the result (all node properties) is in one column/string.
I know that I can write RETURN a.prop1, a.prop2,.... to have properties in each column. But I look for a universal solution like if I do not know which properties one node has.
How is possible to split the query result (string) in multiple columns?

Regards and thank you

2 REPLIES 2

@andrej.zivec

AFAIK, currently there is no way to do something like that without specify explicitly the columns,
see cypher - How to return all the properties in Neo4j to be in diffrent columns - Stack Overflow and Dynamic result columns using Neo4j Cypher - Stack Overflow.


Anyway, I don't know if is useful for your use case,
but maybe you could split the result in rows instead of columns, for example:

MATCH (a) 
WITH properties(a) as props
UNWIND keys(props) as propKey
RETURN propKey, props[propKey] as propValue

For example with this node, create (n:Test {a: 1, b: 2}),
I get:

propKey	| propValue
"a"	    | 1
"b"	    | 2

Sorry but this is not the case for me .... I need columns.
Anyway thank you for your answer it is also useful I learned something new