select convert ( char( 10 ),DonTime , 120) as DonDate , sum( DonMoney )as jz_all ,
sum (case dontype when ' 社会个人捐款 ' then DonMoney else 0 end) as jz_shgr,
count (case dontype when ' 社会个人捐款 ' then 1 else null end ) as jz_shgr_num,
sum (case dontype when ' 单位捐款' then DonMoney else 0 end ) as jz_dw ,
count (case dontype when ' 单位捐款' then DonMoney else null end) as jz_dw_num,
sum (case dontype when ' 单位个人捐款 ' then DonMoney else 0 end) as jz_dwgr,
count (case dontype when ' 单位个人捐款 ' then DonMoney else null end ) as jz_dwgr
from DonationInfo
where 1= 1
and
datediff ( day, DonTime ,'2011-01-01' ) <= 0
and DATEDIFF ( day, DonTime ,'2011-02-04' ) >= 0
group by convert( char (10 ), DonTime, 120 )