select count(sendTime) from GB_F_MobileSMS Group by sendTime having datediff(mouth,SendTime,日期)=0
select 发短总数=count(*) from GB_F_MobileSMS group by convert(varchar(10),sendTime,120)
--查询2月份每天的发短总数 declare @month varchar(2) set @month='2' --这里写参数,查几月写几月。select 日期=convert(varchar(10),sendTime,120),发短总数=count(*) from GB_F_MobileSMS where datepart(month,convert(varchar(10),sendTime,120))=@month group by convert(varchar(10),sendTime,120)
SELECT count(*) FROM 表 where datediff(day,SendTime,日期)=0
select count(*) from GB_F_MobileSMS group by datepart(dd,sendtime) having datepart(mm,sendtime)=? 如求二月份的每一天的发短总数啊 select count(*) from GB_F_MobileSMS group by datepart(dd,sendtime) having datepart(mm,sendtime)=2
上面的不行的话那就这样吧 select count(*) from test where datepart(mm,sendtime)=2 group by datepart(dd,sendtime)
select count(*) from test where left(convert(varchar(10),sendtime,110),2)='00' group by datepart(dd,sendtime)
DECLARE @Month intSet @Month=6select Count(*) AS Num,DatePart(Day,sendTime) AS Day from test Where DatePart(Month,sendTime)=@Month Group BY DatePart(Month,OpeTimesendTime),DatePart(Day,sendTime)
from GB_F_MobileSMS
Group by sendTime
having datediff(mouth,SendTime,日期)=0
from GB_F_MobileSMS
group by convert(varchar(10),sendTime,120)
declare @month varchar(2)
set @month='2' --这里写参数,查几月写几月。select 日期=convert(varchar(10),sendTime,120),发短总数=count(*)
from GB_F_MobileSMS
where datepart(month,convert(varchar(10),sendTime,120))=@month
group by convert(varchar(10),sendTime,120)
group by datepart(dd,sendtime) having datepart(mm,sendtime)=?
如求二月份的每一天的发短总数啊
select count(*) from GB_F_MobileSMS
group by datepart(dd,sendtime) having datepart(mm,sendtime)=2
select count(*) from test where datepart(mm,sendtime)=2
group by datepart(dd,sendtime)
group by datepart(dd,sendtime)
from test
Where DatePart(Month,sendTime)=@Month
Group BY DatePart(Month,OpeTimesendTime),DatePart(Day,sendTime)