原文:sql語句獲取本周、上一周、本月數據

獲取周數據 本周 select from table where datediff week,時間字段,getdate 上周 select from table where datediff week,時間字段,getdate 下周 select from table where datediff week,時間字段,getdate 獲取月數據 本月 select from table where ...

2020-01-17 14:12 0 1724 推薦指數:

查看詳情

sql語句獲取本周本月、本年數據

本周:select * from table where datediff(week,C_CALLTIME,getdate())=0 --C_CALLTIME 為日期字段本月:select * from table where datediff(Month,C_CALLTIME ...

Wed Feb 07 20:11:00 CST 2018 0 1787
Sql Server中查詢今天、昨天、本周、上周、本月、上月數據

Sql Server中查詢今天、昨天、本周、上周、本月、上月數據 在做Sql Server開發的時候有時需要獲取表中今天、昨天、本周、上周、本月、上月等數據,這時候就需要使用DATEDIFF()函數及GetDate()函數了。DATEDIFF ( datepart , startdate ...

Wed Dec 28 18:29:00 CST 2016 0 24411
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM