Problem: Determine the last time a tag had a GOOD value using PI OLEDB. The point has many records (millions).
One query that works for tags that do not have many archived data points is:
SELECT max(time) as TimeofLastGoodValue FROM piarchive.picomp2 WHERE tag = 'tagXYZ' and status = 0
I need a query that can more efficiently zero in on when a tag was last in good status.