how do I subtract values from two select statements

后端 未结 4 1007
没有蜡笔的小新
没有蜡笔的小新 2021-01-19 19:11

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         


        
4条回答
  •  长发绾君心
    2021-01-19 19:53

    select h1.value - h2.value
    from History h1
    inner join History h2 on h1.Datetime = '2010-1-1 10:10' and Datetime ='2010-1-1 10:12'
    

提交回复
热议问题