日期:2014-05-17 浏览次数:23789 次
select case conert(varchar(6),cast(ny as datetime) when '200703' then sum(sj) end '今年3月', case conert(varchar(6),cast(ny as datetime) when '200702' then sum(sj) end '今年2月', case when conert(varchar(6),cast(ny as datetime) IN ('200703','200702','200701') then sum(sj) end '今年1-3月', case conert(varchar(6),cast(ny as datetime) when '200603' then sum(sj) end '去年3月', case conert(varchar(6),cast(ny as datetime) when '200602' then sum(sj) end '去年2月', case when conert(varchar(6),cast(ny as datetime) IN ('200603','200602','200601') then sum(sj) end '去年1-3月' from ny