P
PD
My data as follows;
Asset_Name Asset_Type Property Generated_At Value
Widget1 Press CoreTemp 1/1/2008 08:05:00AM 123.1
Widget1 Press CoreTemp 1/1/2008 08:06:35AM 154.0
Widget3 Boiler FWTemp 1/1/2008 08:05:30AM
75.3
I need to add a column which calculates the difference between the values
for like Assets and Properties. I have a query that gives me the elapsed
time between readings, but I can not seem to use the same technique to
retrieve the value difference. See below for elapsed time query...
SELECT T2.Monitor_Value, T2.Asset_Name, T2.Asset_Type, T2.Property,
T2.Generated_At, (SELECT Min(Generated_At)
FROM Questra T3
WHERE T3.Asset_Name = T2.Asset_Name
AND T3.Asset_Type = T2.Asset_Type
AND T3.Property = T2.Property
AND T3.Generated_At>T2.Generated_At) AS NextReading
FROM Questra AS T2
ORDER BY T2.Asset_Name, T2.Asset_Type, T2.Property, T2.Generated_At;
My goal is to calculate rate of change for each reading.
Thanks,
Asset_Name Asset_Type Property Generated_At Value
Widget1 Press CoreTemp 1/1/2008 08:05:00AM 123.1
Widget1 Press CoreTemp 1/1/2008 08:06:35AM 154.0
Widget3 Boiler FWTemp 1/1/2008 08:05:30AM
75.3
I need to add a column which calculates the difference between the values
for like Assets and Properties. I have a query that gives me the elapsed
time between readings, but I can not seem to use the same technique to
retrieve the value difference. See below for elapsed time query...
SELECT T2.Monitor_Value, T2.Asset_Name, T2.Asset_Type, T2.Property,
T2.Generated_At, (SELECT Min(Generated_At)
FROM Questra T3
WHERE T3.Asset_Name = T2.Asset_Name
AND T3.Asset_Type = T2.Asset_Type
AND T3.Property = T2.Property
AND T3.Generated_At>T2.Generated_At) AS NextReading
FROM Questra AS T2
ORDER BY T2.Asset_Name, T2.Asset_Type, T2.Property, T2.Generated_At;
My goal is to calculate rate of change for each reading.
Thanks,