数据结构是这样的。
time date
2006-05-01 12:00:00 1200
2006-05-01 13:00:00 3000
2006-05-01 14:00:00 1200
2006-05-02 12:00:00 3600
2006-05-02 13:00:00 3000
我想选出时间为2006-05-01的所有记录怎么写呀。
time date
2006-05-01 12:00:00 1200
2006-05-01 13:00:00 3000
2006-05-01 14:00:00 1200
2006-05-02 12:00:00 3600
2006-05-02 13:00:00 3000
我想选出时间为2006-05-01的所有记录怎么写呀。
insert into @t select '2006-05-01 12:00:00' ,1200
union all select '2006-05-01 13:00:00' ,3000
union all select '2006-05-01 14:00:00' ,1200
union all select '2006-05-02 12:00:00' ,3600
union all select '2006-05-02 13:00:00' ,3000select * from @t where [time]>='2006-05-01' and [time]<'2006-05-02'select * from @t where convert(varchar(10),[time],120)='2006-05-01'