我正在使用以下命令通过CSV将数据加载到neo4j中:
load csv with headers from "file:///path_to.csv" as file
merge (d:DIAGNOSIS {name:file.DIAGNOSIS_SYNONYM})
merge (dn:DRUG_NAME {name:file.DRUG_NAME})
merge (tc:TOTAL_COST {name:toFloat(file.TOTAL_COST)})
merge (cnt:COUNT {name:toInt(file.COUNT)})
merge (ac:AVERAGE_COST {name:toFloat(file.AVERAGE_COST)})
create (dn)-[:for]->(d)
create (d)-[:costs]->(tc)
create (tc)-[:count]->(cnt)
create (cnt)-[:avg_costs]->(ac)
现在我想找到具有最高/最低总成本的诊断。
我尝试过:
MATCH ((dn)-[:for]-(d)-[:costs]-(tc)-[:count]-(cnt)-[:avg_costs]->(ac))
WITH d,tc, max(tc.name) as maximum
where tc.name= maximum
return d
然而,这会返回所有的诊断节点。有人能建议我错在哪里吗?