Have you tried passing over age21 in the second WITH just as the 'n' so it is available in the return?
/peter
Send from mobile device.
--
--
There is no limit of with statements.What do you want to do?It does not make sense to aggregate over a value and then access the individual node again?start n=node(*)where id(n) <> 0with n.age? as age, count(*) as cntwhere age = 21 or age = 22return cnt
--
Michael and Andres assume that I wanted to get the combined number of age21 + age 22, while I want each of these as a separate number. I apologize, I wasn't clear on that.
start n=node(*)where id(n) <> 0 and (age = 21 or age = 22)return age, count(*)
+----------------------+ | n.name | count(*) | +----------------------+ | "Neo" | 1 | | "Trinity" | 1 | +----------------------+
+----------------------------+ | n.name | count(*) | +----------------------------+ | "Neo" | 1 | | "The Architect" | 1 | | "Trinity" | 1 | +----------------------------+
Getting closer, bur still do not know how to get the number of nodes with a name starting with 'T and with 'N'. I could use the returned data shown above and do processing on the recipient side, but the returned data could be quite long.
I still hope that there is a way to get a result like this:
+----------------------------+ | n.name | count(*) | +----------------------------+ | '(?i)N.*' | 1 | | '(?i)T.*' | 2 | +----------------------------+
Chris
--
--
--
| Michael, Different Chris. =) |
|
Hi Michael and Peter,I am running into a similar problem, don't really know how to solve this.The query is:start n=node(*)
where id(n) <> 0 and n.name =~ '(?i)T.*'
with collect(n) as Ts start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)N.*'
with Ts, collect(n) as Ns start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)C.*'
with Ts,Ns, collect(n) as Cs start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)A.*'
with Ts,Ns,Cs, collect(n) as As start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)F.*'
return Ts,Ns,Cs,As, collect(n) as FsAnd the query returned:+------------------------+
| Ts | Ns | Cs | As | Fs |
+------------------------+
+------------------------+
0 row 0 ms
Is it a bug ? Shouldn't it return the Ts,Ns,Cs,As and Fs should be just null ?The following query is just fine:start n=node(*)
where id(n) <> 0 and n.name =~ '(?i)T.*'
with collect(n) as Ts start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)N.*'
with Ts, collect(n) as Ns start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)C.*'
with Ts,Ns, collect(n) as Cs start n = node(*)
where id(n) <> 0 and n.name =~ '(?i)A.*'
return Ts,Ns,Cs,collect(n) as As
with correct result:+--------------------------------------------------------------------------------------------------------------------------------------------+
| Ts | Ns | Cs | As |
+--------------------------------------------------------------------------------------------------------------------------------------------+
| [Node[3]{name:"Trinity"},Node[6]{name:"The Architect"}] | [Node[1]{name:"Neo"}] | [Node[4]{name:"Cypher"}] | [Node[5]{name:"Agent Smith"}] |
+--------------------------------------------------------------------------------------------------------------------------------------------+
1 row
0 msIn the mean time, do you know any work-around ?Thank in advance,Nghia Doan
--
--
--
--