I would like to subtract one value from another value. The schema of the table is as follows:
tag, datetime,value
------------
tag1, 2010-1-1 10:10
What is the type of the value column? If it is already an integer just do:
SELECT
(Select Max(Value) as [Value1] from History WHERE Datetime ='2010-1-1 10:10' and tagname ='tag1') as v1 -
(Select Max(Value) as [Value2] from History WHERE Datetime ='2010-1-1 10:12' and Tagname ='tag2') as v2
else you will have to cast it as an integer or whatever numeric type you want