where clause

Soldato
Joined
18 Oct 2002
Posts
15,187
Location
The land of milk & beans
Assuming this is a SQL query, you define the columns to return in the select list, not the where clauses. The syntax would be something like this, but this query itself would be pretty useless:

SQL:
SELECT
  CONCAT([a], [b]) AS [c]
WHERE
  [a] = [b]

As @Armageus said, some context or a code sample would help a lot here.
 
Last edited:
Permabanned
OP
Joined
22 Mar 2020
Posts
2,337
Assuming this is a SQL query, you define the columns to return in the select list, not the where clauses. The syntax would be something like this, but this query itself would be pretty useless:

SQL:
SELECT
  CONCAT([a], [b]) AS [c]
WHERE
  [a] = [b]

As @Armageus said, some context or a code sample would help a lot here.

It is for neo4j.
I have the relationships where by they are both independent each other, yet match them up to their respective groups. yet I want to only return the same names in the table.

So I have 4 nods that have no relationship to anything. One nodeA having a relationship to other nods. Get a list of the tables properties such as name or dob that contain key values which match with all the nods that are independent of any relationship and nodA.
 
Last edited:
Permabanned
OP
Joined
22 Mar 2020
Posts
2,337




the idea is find matches of mike that drives a red and blue car.
Also cars that do not have any relationships with a colour match's red or blue.

match (p : person {name: "Mike})-[:drives]->(b:Car)
where not : (b:car)--->p[r]--> ()
return p.name, b.colour, b.name
 
Last edited:
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
where a=b

rather than have return a,b
is it possible to have
where [a=b] as C

return it as C ?
If a=b then they are the same. Why do you need to return 2 things the same? Just return one of them (and you can name it C if you want but I don't see what difference that makes?)
 
Soldato
Joined
3 Jun 2005
Posts
3,061
Location
The South


the idea is find matches of mike that drives a red and blue car.
Also cars that do not have any relationships with a colour match's red or blue.

match (p : person {name: "Mike})-[:drives]->(b:Car)
where not : (b:car)--->p[r]--> ()
return p.name, b.colour, b.name

In SQL you can do subqueries (not ideal but...) for the 'where not' but it sounds like it should be two separate queries - one for getting 'mikes' 'blue' and 'red' cars and then another for getting all cars that aren't red or blue that aren't a relationship to 'mike'.

Have you got a physical database structure (tables etc) for the data you're storing?
 
Permabanned
OP
Joined
22 Mar 2020
Posts
2,337
If a=b then they are the same. Why do you need to return 2 things the same? Just return one of them (and you can name it C if you want but I don't see what difference that makes?)
I am matching a list from two variables. To return a list that have the same key values leaving out key values they don't have in common.
 
Permabanned
OP
Joined
22 Mar 2020
Posts
2,337
Could you please explain how you resolved it? I say this for my past and future self, scrolling through countless forum posts about definitely common and simple issues that are declared solved without the solution posted :p

Did not need to touch the where clause. By separating the relationships and creating New variable. It is cypher not SQL, Majority will not have used that yet.
 
Last edited:
Back
Top Bottom