Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-02-2022 04:24 AM - edited 12-02-2022 04:26 AM
Hi,
Please, I am getting an error with a query, an example illustrated below. My objective is to obtain the family_names based on the matches of first_name etc. Where the most suitable match comes on top, and then other matches with common first_name follow in ascending order, as displayed in the table.
However, I am getting a Cypher syntax error. Please, how do you suggest I fix the issue?
Thanks.
Solved! Go to Solution.
12-02-2022 04:32 AM - edited 12-02-2022 04:49 AM
You have two ‘where’ clauses. Change the second ‘where’ clause to ‘and’.
Also, you can’t order by a node, as you are trying to do with ‘order by f’ change it to ‘order by f.first_name asc’
finally, you can’t have a pattern as a predicate. You can change them to use ‘exists’ to convert them to predicates. For example, change ‘(f)-[:first_name]->(n)’ in the ‘where’ clause to ‘exists((f)-[:first_name]->(n))’.
question: why do you need to match to the other nodes ‘race’ and ‘hometown’, as it seems you just want to find the last name of everyone whose first name contains ‘jay’. You will not receive your expected results you list with your query, because all three don’t match the values of race and hometown in your query. You should get your expected results with the following query:
12-02-2022 04:32 AM - edited 12-02-2022 04:49 AM
You have two ‘where’ clauses. Change the second ‘where’ clause to ‘and’.
Also, you can’t order by a node, as you are trying to do with ‘order by f’ change it to ‘order by f.first_name asc’
finally, you can’t have a pattern as a predicate. You can change them to use ‘exists’ to convert them to predicates. For example, change ‘(f)-[:first_name]->(n)’ in the ‘where’ clause to ‘exists((f)-[:first_name]->(n))’.
question: why do you need to match to the other nodes ‘race’ and ‘hometown’, as it seems you just want to find the last name of everyone whose first name contains ‘jay’. You will not receive your expected results you list with your query, because all three don’t match the values of race and hometown in your query. You should get your expected results with the following query:
12-02-2022 05:21 AM - edited 12-02-2022 06:06 AM
Got it!
All the sessions of the conference are now available online