Sql server 将MS Access sql语句转换为MS sql语句
此MS Access sql语句到MS sql语句的转换是什么:Sql server 将MS Access sql语句转换为MS sql语句,sql-server,Sql Server,此MS Access sql语句到MS sql语句的转换是什么: Select * from iapt where appt_id in (Select distinct appt_id from iaptd where po_id in(Select distinct po_id from irct
Select *
from iapt
where appt_id in (Select distinct appt_id
from iaptd where po_id in(Select distinct po_id
from irct
where verify_dtim = Date()-1))
我想你只需要换衣服
Date() - 1
到
从
GETDATE()
(今天)中减去一天
到目前为止你试过什么?提示:
DATE()。一个返回日期,另一个返回日期和时间。单独的DATEADD(dd,-1,GETDATE())
不太可能提供正确的结果。@Larnu您是对的,准确地说,我们可以使用CAST(GETDATE()作为日期),在答案中更改了这一点。
DATEADD(dd, -1, CAST(GETDATE() AS DATE))
Select *
from iapt
where appt_id in (Select distinct appt_id
from iaptd where po_id in(Select distinct po_id
from irct
where verify_dtim = DATEADD(day, -1, convert(date, GETDATE())))