I’m still new to Ignition and very new to SQL, I’ve hit a bit of a wall with an SQL command.
I have a 15 minute transaction group running, in this group I store various OPC values including a accumulated KWh value which will always get bigger. What I’d like to do is to take the second to last value and subtract it from the latest value to give a KWh in the last 15 minutes value, then place this value in a dedicated column in the same table and row of the latest value.
I know how to find the last value (using SELECT COUNT) and I so I can find the second to last value as well. I have tried using an expression tag to read the current value minus the latest stored value and this works well, and then have the transaction group reads the tag. At this point the value seem to go wrong and read too high by almost double, if as if its reading a 30 min value but not exactly.
Is there a SQL request that could do this without the need for an expression tag?