Capula01

Help with a confusing query

Discussion created by Capula01 on Aug 25, 2010
Latest reply on Aug 25, 2010 by spilon

Hi all,

 

Im trying to write a query that will return the top 5 values of a tag, lets call it "tag1", over the past 7 days, but only if another tag, lets say "tag2" has a certain value at the same time.

 

So something like:

 

SELECT value, time from piarchive
WHERE tag = 'tag1' and time = '>*-7d' AND tag2.value = "ON" AND tag2.time = tag1.time

 

Any help to would be much appreciated, im pretty new to this stuff.

Outcomes