Hi all, I am a beginner in Cypher and would like to seek for some help here.
I want to merge two sets of data,one is from database table by using ````match` command,other is import from csv file,so my CQL is below:
Match(u:user) return u.name as name,u.age as age,u.sex as sex,u.job as job order by name union match(o:other) load csv from `'http://location:3434/otherjob.csv' as x return x[0] as name,x[1] as age,x[2] as sex,x[3] as name,x[4] as job
It's works when i was testing on the neo4j brower,but there was an error when I tested in the production environment.the server return.
"message" : "Only one column is supported currently in orderBy param.",
Can anyone can help me why does this error appear and how to fix it?
The ‘combine’ means data A+data B,I don’t know how to query the result which contain the data from user and csv file in one CQL command.I just only know the
MATCH <clause> RETURN order by UNION MATCH <clause> LOAD CSV <clause> RETURN
This match is just trying to make this code work(load csv from)
hum...If you want the data from the spreadsheet to be added to the database, you need to write a query for that. You can then query for all the data you want after persisting the csv data. As you have it now, you are just reading the csv file and outputting from the query. You can try a query like the following to persist the csv data:
load csv from 'http://location:3434/otherjob.csv' as x
with x[0] as name, x[1] as age, x[2] as sex, x[3] as job
merge(n:user{name: name})
set n.age = age, n.sex = sex, n.job = job
Now, executing the following query you will get all the data, which includes the imported csv data:
match(u:user)
return u.name as name, u.age as age, u.sex as sex, u.job as job
order by name
I agree with @dana_canzano. The intent of the query is confusing. What do you mean by "combine", as you are not persisting the data from the csv file. You are just reading it and output it each query execution.
Also, what is the purpose of the following match? The query doesn't use the variable 'o' anytime after the match.