- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
先看看我写的语法吧
[code=sql]SELECT * FROM table WHERE createtime>=st AND createtime<=et
SELECT * FROM table WHERE createtime BETWEEN st AND et[/code]
这样就行了
[code=sql]SELECT * FROM table WHERE createtime>=‘2012.12’ AND createtime<=‘2013.4’
SELECT * FROM table WHERE createtime BETWEEN ‘2012.12’ AND ‘2013.4’[/code]
但是人家说只精确到月好吧我再修改下
[code=sql]SELECT * FROM table WHERE createtime>=CONVERT(VARCHAR(7), st, 121) AND createtime<=CONVERT(VARCHAR(7), et, 121)
SELECT * FROM table WHERE createtime BETWEEN CONVERT(VARCHAR(7), st, 121) AND CONVERT(VARCHAR(7), et, 121)[/code]
OK了
|
|