Skip to content
Advertisement

Add a filter to timeseries pairs

I have a time series plc tag data as below with values in ‘1’ or ‘0’

JavaScript

Using below code I can get the output

JavaScript

Output

JavaScript

But my requirement is, I only want to query going back 25 hours, so I add a predicate:

JavaScript

But this returns the error:

Msg 209 Level 16 State 1
Ambiguous column name ‘datetime’.

Advertisement

Answer

You have two subqueries that both contain a column named datetime. When you say:

JavaScript

You need to tell SQL Server which one you mean. So either:

JavaScript

… or …

JavaScript

I’m going to guess it should be tOn.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement