Load data from CSV

Capture

Hi
I am trying to load the CSV using the following query.

load csv with headers from "file:///test.csv" as line
merge(a:Client{Name:line.TradingMember})
merge (b:Company{Name:line.WorksFor, ISIN:line.ISIN,Security:line.Security})
merge (a)-[:Employee]-(b)
with b,line
match (a:Client),(b:Company)
where b.Name=line.OwnsSymbol
merge (a)-[:Has_DebitCard{asd:line.Volume}]->(b)

I got this as output
graph
The expected output is that the OwnsSymbol column should be used as Company Name rather than creating a new node to form a relationship with the Client node as Has_Debit. The Mapping of Has_Debit is wrong according to the CSV.

hey,
Im facing the same kind of problem. I'm trying to dynamically match similar string and make a relationship without creating new node !!! :crazy_face:

Hello,

You should modify your query as follows:

load csv with headers from "file:///test.csv" as line
merge(a:Client{Name:line.TradingMember})
merge (b:Company{Name:line.WorksFor, ISIN:line.ISIN,Security:line.Security})
merge (a)-[:Employee]-(b)
with a, b,line
match (b:Company {Name: line.OwnsSymbol})
merge (a)-[:Has_DebitCard{asd:line.Volume}]->(b)

This is where the issue lies. You want to bring forward the results of 'a' and include these results in your WITH statement. Otherwise, you are doing a new separate query with the MATCH (a:Client) statement.

-yyyguy