所以,我是一个完全的菜鸟,我一直在努力使用这段代码,我知道这是一件简单的事情,但尽管如此。
我知道变量的作用域从WITH语句更改为WITH语句,但它是否也随着where语句的变化而变化?我需要返回一个具有各自纬度和经度的节点。我不能调用"live“变量,因为它不在作用域内--至少neo4j桌面是这么说的
这是我的代码
load csv with headers from "file:///latlong1.csv" as home
load csv with headers from "file:///latlong2.csv" as live
WITH point({ latitude:toFloat(home.lath), longitude:toFloat(home.longh)}) AS p1,
point({ latitude:toFloat(live.latl), longitude:toFloat(live.longl)}) AS p2
with toInteger(distance(p1,p2)/1000) AS km
where km > 5
merge (redalert{dist:km, Latitude:live.latl, Longitude:live.longl})
return redalert如果有人能帮我修改一个替代的代码,那就太好了!
提前感谢
发布于 2020-05-14 19:40:59
您需要在每个WITH中包含live,这样它才能在查询中继续。试试这个,看看它是否有效。
load csv with headers from "file:///latlong1.csv" as home
load csv with headers from "file:///latlong2.csv" as live
WITH live, point({ latitude:toFloat(home.lath), longitude:toFloat(home.longh)}) AS p1,
point({ latitude:toFloat(live.latl), longitude:toFloat(live.longl)}) AS p2
with live, toInteger(distance(p1,p2)/1000) AS km
where km > 5
merge (redalert{dist:km, Latitude:live.latl, Longitude:live.longl})
return redalerthttps://stackoverflow.com/questions/61790623
复制相似问题