查询30天之内的SQL Server语句怎么写?

2025-12-18 09:09:48
推荐回答(3个)
回答1:

select * from A where
insdate between convert(varchar(10),getdate()-30,120) and convert(varchar(10),getdate(),120)

回答2:

可以这样写 select * from A where insdate?=trunc(sysdate)-30

回答3:

SELECT * FROM 表名 WHERE ABS(DATEDIFF(DAY,GETDATE(),日期字段))<30