Hi,
I want to do something like this -
Get Wind_direction, Wind_speed, SiteCode, Latitude, Longitude side by side-
The problem is that (DataValue as wind_direction) Wind_direction and (DataValue as)wind_speed are under the same column DataValue and for Wind_direction variableID is 4 and for Wind_speed is 3
the schema can be found here (Fixed to show instead - NeoPa)
And here's the query I wrote-
Thanks!
Piyush
I want to do something like this -
Get Wind_direction, Wind_speed, SiteCode, Latitude, Longitude side by side-
The problem is that (DataValue as wind_direction) Wind_direction and (DataValue as)wind_speed are under the same column DataValue and for Wind_direction variableID is 4 and for Wind_speed is 3
the schema can be found here (Fixed to show instead - NeoPa)

And here's the query I wrote-
Code:
SELECT TOP(61) DataValues.DataValue AS Wind_speed, DataValues.DataValue AS Wind_direction, Sites.SiteCode, Sites.Latitude, Sites.Longitude FROM DataValues INNER JOIN Sites ON DataValues.SiteID = Sites.SiteID WHERE DataValues.DataValue IN (Select DataValue FROM DataValues WHERE DataValues.VariableID=3) OR DataValues.DataValue IN (SELECT DataValue FROM DataValues WHERE DataValues.VariableID = 4) ORDER BY LocalDateTime DESC;
Piyush
Comment