SQL日求日期

//求昨天
select convert(varchar(10),getdate()-1,120)
//求明天
select convert(varchar(10),getdate()+1,120);
//求最近七天
select * from tb where  時間字段>=convert(varchar(10),getdate()-7,120);
//求後七天
select * from tb where  時間字段<=convert(varchar(10),getdate()+7,120) and 時間字段等於>=時間字段;
發佈了41 篇原創文章 · 獲贊 13 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章