1樓:文走
假設我想查詢2013-12-23的資料,則sql語法如下:
select * from [table] where datediff(dd,[日期],'2013-12-23')=0
假設我想查詢2013-12-1到2013-12-25之間的資料,則如下:
select * from [table]
where datediff(dd,[日期],'2013-12-1')<=0
and datediff(dd,[日期],'2013-12-25')>=0
或者select * from [table]
where [日期] between '2013-12-1' and '2013-12-25'
2樓:檀敏博
select * from table where 日期 between to_date('2013-07-30','yyyy-mm-dd') and to_date('2013-12-25','yyyy-mm-dd');
sql語句日期問題
轉換格式就好了 select convert varchar 100 getdate 23 2006 05 16 select convert varchar 100 getdate 0 05 16 2006 10 57am select convert varchar 100 getdate 1 ...
sql查詢問題
1全部如果原表是 table1 a1,a2,a3 select a1,sum case when a2 1 and a3 是 then 1 else 0 end b1,sum case when a2 2 and a3 是 then 1 else 0 end b2,sum case when a2 ...
sql分組查詢問題
select a.b.已填報,c.未填報 from 以業務統計 select d.matter,d.type d.stardate,d.enddate from pz plandetails d inner join pz planexe e on e.planid d.planid group b...