select convert(char(8),[UseTime],112) dt,
sum([UseMoney]) 合计,
sum(case when [S_Number]=2 then UseMoney else 0 end ) as '状态2',
sum(case when [S_Number]=3 then UseMoney else 0 end ) as '状态3'
from [TX_DB].[dbo].[Fjc_Money_User]
group by convert(char(8),[UseTime],112) order by dt