这是我在sql中的查询:
with cte
as(
select top 1
Id,
(((DATEPART(hour, CAST([Time] AS DATETIME)) * 60) + (DATEPART(minute, CAST([Time] AS DATETIME)) ) )) AS Tim,
Price
from Prices order by [Time] desc
)
,cte1 as(
select
(((DATEPART(hour, CAST([Time] AS DATETIME)) * 60) + (DATEPART(minute, CAST([Time] AS DATETIME)) ) )) as tim1
from M1
)
现在我想这样做;如果cte.tim = cte1.tim1,更新表中的一行,否则插入表中,但我不知道如何? 非常感谢