sql语句获取本周、本月数据 天高地厚

本周:select * from table where datediff(week,C_CALLTIME,getdate())=0     --C_CALLTIME 为日期字段
本月:select * from table where datediff(Month,C_CALLTIME,getdate())=0   --C_CALLTIME 为日期字段
本季:select * from table where datediff(qq,C_CALLTIME,getdate())=0
前半年1-6,后半年7-12:select * from table where datepart(mm,C_CALLTIME)/7 = datepart(mm,getdate())/7

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/eyu777/archive/2009/06/18/4280303.aspx

不登高山,怎知天高;不临深溪,焉知地厚!站在坚实的土地上,做着生命中最真实的事情;像一棵挺拔的大树,认可自己的命运并敢于迎接属于这一方天空的风风雨雨。

原文地址:https://www.cnblogs.com/net2012/p/2822945.html