AnsweredAssumed Answered

PI OLEDB Select question

Question asked by DaveThompson on Aug 28, 2019
Latest reply on Aug 29, 2019 by rschmitz


 I'm trying to do what Ithought was a simple query but I've already spent way to much time trying to get it to work. I feel like I'm just running into a syntax problem and am hoping to get some help with what I'm doing wrong. In a nutshell we have SQL with a linked PI db using PI OLEDB.


Heres the SQL select statement that I'm using. I have created a test table in SQL and this works great there, but no luck when moving over to the PI db.


Select r1.tag, r1.time, r1.value from piarchive..picomp2 r1
Where r1.time >= '8/1/2019' AND r1.tag='TagName' AND r1.Value <> (Select top 1 Value From piarchive..picomp2 where Time < r1.Time
Order by Time desc)


Am I at least close?