select * from tableGet order by time得到数据如图所示
select * from tableGet where time>='2013年10月28日' and '2013年10月29日'<time
我想查询10月28号到10月29号之间的数据这么些对吗??
select * from tableGet where time>='2013年10月28日' and '2013年10月29日'<time
我想查询10月28号到10月29号之间的数据这么些对吗??
改为这样,把后面的< 改为> :
select * from tableGet where time>='2013-10-28' and '2013-10-29'>time
select * from tableGet where time>='2013-10-28' and '2013-10-29'>=time还是只有28号的:
select * from tableGet where time>='2013-10-28' and '2013-10-29'>time
select * from tableGet
where time between '2013-10-28' and '2013-10-29'
order by time
那么这么写select * from tableGet
where convert(char(10),time,120)='2013-10-28'
order by time也就是年月日是2013-10-28,不管时分秒
要仔细后面的应该是小于号哈,改写一下就是:select * from tableGet where time>='2013-10-28' and time > '2013-10-29'
from tableGet
where convert(char(10),[time],120) between '2013-10-28' and '2013-10-29'
要仔细后面的应该是小于号哈,改写一下就是:select * from tableGet where time>='2013-10-28' and time > '2013-10-29'你还是改错了
再改一下:
select * from tableGet where time>='2013-10-28' and time <'2013-10-29'
要仔细后面的应该是小于号哈,改写一下就是:select * from tableGet where time>='2013-10-28' and time > '2013-10-29'你还是改错了
呵呵,还真是改错了:
select * from tableGet where time>='2013-10-28' and time <= '2013-10-29'
这样呢?:
select * from tableGet where time>='2013年10月27日' and '2013年10月30日'<time
select * from tableGet where time>='2013-10-27' and time<'2013-10-30'
select * from tableGet
where time>=replace(replace(replace('2013年10月27日','年','-'),'月','-'),'日','-')
and time<replace(replace(replace('2013年10月30日','年','-'),'月','-'),'日','-')
select * from tableGet
where time>=replace(replace(replace('2013年10月27日','年','-'),'月','-'),'日','-')
and time<replace(replace(replace('2013年10月30日','年','-'),'月','-'),'日','-')
where time>=replace(replace(replace('2013年10月27日','年','-'),'月','-'),'日','-')
and time<=replace(replace(replace('2013年10月30日','年','-'),'月','-'),'日','-')
最终结果写成这样是可以的不过想问一下,加红色标注的这个是什么意思?转义时间类专成字符串类,为什么还要写成【time】,120呢??
哦 这个convert是个转化函数,把[time]转出了一个字符串,类似于'2013-10-28'这样,因为你后面的控件,返回的也是字符串,两个字符串进行比较
哦,120是一个styleID,表示了转化成哪一种日期格式:就是转化为: yyyy-mm-dd hh:mi:ss(24h) 这种格式