SQL語句查詢特定時間段的數(shù)據(jù)怎么寫
SQL語句查詢特定時間段的數(shù)據(jù)怎么寫
慕容3067478
2018-12-08 11:07:10
TA貢獻(xiàn)1877條經(jīng)驗(yàn) 獲得超6個贊
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'
舉報