谢谢
这个问题第1个回答:
SQL code
select * from tab
where time>=dateadd(day,-15,convert(varchar(10),getdate(),120))
and time<dateadd(day,1,convert(varchar(10),getdate(),120))
这个问题第2个回答:
这是效率最高的写法
这个问题第3个回答:
SQL code
select * from tablename where time between DateAdd(dd,-15,gedate()) and getdate()
这个问题第4个回答:
SQL code
SELECT *
FROM tablename
WHERE [time] IN(
SELECT TOP 15 [time]
FROM tablename
ORDER BY [time] DESC
)
这个问题第5个回答:
SQL code
select * from tablename where time>=dateadd(dd,-15,getdate())
这个问题第6个回答:
SQL code
select * from tablename where time between DateAdd(dd,-15,getdate()) and getdate()
这个问题第7个回答:
上面120代表什么?能说说上面那个语句吗?
这个问题第8个回答:
SQL code
select * from tab
where time>=dateadd(day,-14,convert(varchar(10),getdate(),120))
最近十五天包括今天的话-14就可以了。
这个问题第9个回答:
120代表一种时间格式
20 或 120 (2) ODBC 规范 yyyy-mm-dd hh:mi:ss(24h)
这个问题第10个回答:
120 將datetime 轉為 '2008-09-25' 的varchar(10) 的格式
这个问题第11个回答:
谢谢各位