请教一个简单的SQL语句 表tb,有字段time要取当前系统时间之前的10天内记录,该怎么写呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from tb where time between getdate()-10 and getdate() 就是想知道如何获得当前系统前10天的具体日期,想用between .. and getdate()不用datediff()...因为影响速度 select * from tb where time between dateadd(mm,-10,getdate()) and getdate() dateadd() SQL 日期函数,看看SQL 帮助文档吧。 select * from tb where datediff(dd, [time],getdate())<=10-- 如果是10个月内呢? select * from tb where datediff(mm, [time],getdate())<=10 select * from tb where time between dateadd(dd,-10,getdate()) and getdate() 关于MSDE数据库的问题 我怎么可以完成 完整的 查询功能 不关是 3个条件 2个条件 1个条件 LIKE子句的问题 取出二列中最小的数怎么做. 如何分离正在使用的数据库 这个如何用sql语句写出一个报表啊 就是写一个表格的形式 等待“hyqok”的关于SQL分页代码效率低的回复 inner join语句如何优化? 数据最大限度均匀分布的问题 在sql server日志中有如下内容:tmpdb日志已满。我发现硬盘还有空间,而且tmpdb日志为无限制增加.请问为何会出现如下内容.我该如何处理. 怎么样远程备份和更新数据库 SQL中的CHECK约束问题
不用datediff()...因为影响速度
select * from tb where time between dateadd(mm,-10,getdate()) and getdate()
select * from tb where datediff(dd, [time],getdate())<=10-- 如果是10个月内呢?
select * from tb where datediff(mm, [time],getdate())<=10