public
Last active

  • Download Gist
Query1_original.sql
SQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14
start t=node:types(id={id})
match
(t)<-[:has_type]-(u)<-[:metric_unit]-(ma)<-[:metric_activity]-(m)<-[cm:cycle_metric]-(c)
where
c.measureDate>={measureStart} and c.measureDate <= {measureEnd}
with distinct m, ma, u, c
match
(ma)-[:metric_unit]->(u)<-[:alert_for_unit]-(a)-[:alert_for_inspection]->(i)-[:has_result]->(ir)
<-[:for_inspection_result]-(a)
where
a.alertDate=c.measureDate
and ((i)<-[:metric_inspection]-(ma))
and a.fromEntityType={type}
return ir.value as alertValue, count(ir.value) as alertCount, u.id as unitId, u.name as unitName

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.