I am trying to update an old query from an excel spreadsheet with VBA code.
I would like to add a filter on an another tag named STOP_Filtered and where the value is egal to 600.
It's a little bit tricky because as you can see in the example below, the current query shows the results of 4 tags in the same table. The filtered table will have to check for each tag its corresponding STOP_Filtered tag.
I hope someone could help.
SELECT DISTINCT left(NU.tag,9) AS "Turbine Number", Nu.time as "Timestamp", NU.value AS "Status State" FROM (SELECT tag, time, value, _index FROM piarchive..picomp2 WHERE tag like '%LDTE%WT%-KPIS_FINALFIRSTFAULTS' AND time >= '01/12/2016' AND time <= '01/01/2017' AND value <>-1 ) NU OPTION (FORCE ORDER)
|Turbine Number||Timestamp||Status State|