Saturday, 15 February 2014

neo4j - Complex query with agregation in where clause -


Suppose i have a graph in which for each node m, type can be of node of ballt of n Type a hairdresser that connects them to the relay relationship of type, i.e., p = (m: BallT) - [r: rel] - (k: balld) - [s: rel] can have several patterns . - (N: BallT) . For a given node m (for example, satisfactory m.key = "whatever" ), the number of bond connecting to the NMN m and some nodes n and n Total Number BallD Nodes How can I get all Nodes of NMN> N / 2 for this given node M and order results by NNM? I'm trying to query:

  match (D: BallD) with counting (D) as the N match (m: BallT {key: "whatever"}) - [r ] - (d: BallD) - [S] - (N: BallT) with N, specific as NDI, count as NMN (D) where NMN & gt; = NNN DID order NMN  

but I'm getting

  invalid input 'T': expected white location, comment, node label , Map-written, a parameter, relationship pattern  

Do you have this question? MATCH (m: BallT {key: "whatever"}) - (d: BallD) - (n: BallT)

  MATCH (D: BallD) with Gin (D) ) With N, N, NMN WHERE NmN as Count (D) = N / 2 returns N, NMN ORMER BY NmN  
  • When using any aggregation function (such as count ) on the value (Like n ), you do not have to use DISTINCT to qualify for that value, which is focused on you - it's done automatically for you goes.

  • By order argument, see the AP art of returned values.

  • In addition to this, I corrected the use of the WHERE to the N / 2 .

    >

No comments:

Post a Comment