想要一个sql查询以根据日期细化数据 [英] want a sql query to fine data depend on dates

查看:64
本文介绍了想要一个sql查询以根据日期细化数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select * from gen_complaints where date between ('2011/01/01' , '2011/12/01') 


那是我的查询,它不能正常工作,任何人都不能给出正确的格式.


That is my query it is not working can any one give correct format.

推荐答案

也许尝试


Maybe try


select * from gen_complaints where (date between '2011/01/01' AND '2011/12/01')


由于sql中的日期格式为''yyyy-mm-dd'',因此您可以尝试
Since the date format in sql is ''yyyy-mm-dd'' you can try with this.


这将起作用

This will work

select * from gen_complaints where date between Convert(datetime,''01/01/2012''104) AND Convert(datetime,''01/12/2012'',104) 



谢谢



Thanks


这篇关于想要一个sql查询以根据日期细化数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆