I'll try to explain this one with as little code as possible.
I have created a table that defines certain tags and thier properties
If I write code like ( this is a query to the table i created)
Select Tag From Tags where shift = 'Am'
I get a list of 200 or so tags
To get the values of that have values I want to see I write
select h.tag, max(value) from v_history as h where tag in ('Tagname1') or tagn in ('tagname2')
THIS WORKS FINE.... here is where I am running into trouble
If I define a CTE
with am as ( Select Tag as am_tag From Tags where shift = 'Am' )
Then try to run the query
select h.tag, max(value) from v_history as h where h.tag in am_tag
I get an error that says i must have at least one tag for history queries.
I think what i need to do is have a query that writes out the tagname (maybe runing one line at a time??) any ideas ?