(1)Convert 函数
select Convert ( VARCHAR(7),ComeDate,120) as Date ,Count(In_code) as 单数,Sum(SumTrueNum) as 件数
from T_In_Top
where ComeDate between '2013-01-01' and '2014-08-04' and In_top_State='已完成' and Case_ID=14 and Store_ID=41
group by Convert ( VARCHAR(7), ComeDate, 120)
(2)日期函数 year([date])
select year(ComeDate),month(ComeDate),Count(In_code) as 单数,Sum(SumTrueNum) as 件数
from T_In_Top
where Case_ID=14 and In_top_State='已完成' and Store_ID=41 and year(ComeDate)>=2013
group by month(ComeDate),year(ComeDate)
--(cast(year(ComeDate) as varchar(4))) cast 函数 类型转换
版权声明:本文为博主原创文章,未经博主允许不得转载。