SQL語句查詢特定時間段的數(shù)據(jù)怎么寫
SQL語句查詢特定時間段的數(shù)據(jù)怎么寫
拉風(fēng)的咖菲貓
2018-12-31 00:00:59
TA貢獻2012條經(jīng)驗 獲得超12個贊
select * from 表 where 日期字段>='開始日期' and 日期字段<='截止日期'
and convert(char(8),日期字段,108)>='開始時間' and convert(char(8),日期字段,108)<='截止時間'
例如:
select * from tb1 where dDate>='2010-11-05' and dDate<='2010-11-15'
and convert(char(8),dDate,108)>='22:30:00' and convert(char(8),dDate,108)<='23:00:00'
舉報