ACL427

Find Last Good Value

Discussion created by ACL427 on Feb 10, 2010
Latest reply on Feb 19, 2010 by spilon

Hi,

 

I'm needing to write a query to identify current 'Bad' Values and the last time they were 'Good'.

 

Identifying the 'Bad' Values is working nicley but I have not been able to find a way to find the last 'Good' Value.

 

Here is the query for the current Bad values.

 

SELECT
*FROM OPENQUERY(PI,'
select tag as Tag,
DIGSTRING(status) As Status,
time as Curr_Time_Stamp
from piarchive..pisnapshot
where tag in (
  select tag from pipoint..classic
  where tag LIKE ''%BADTAGS%'')
  and DIGSTRING(status) = ''Bad''
  order by time
')

 

Any suggestions on how to find the last good value? 

 

Thanks in advance for any suggestions!

Attachments

Outcomes