一次sql排序的问题。

 

select date, count(fail) as fail,count(win) as win from
(select date,(case (result) when 'fail' then 'fail' end ) as fail,(case (result) when 'win' then 'win' end ) as win from games
) d group by date

 

 

 

select Name, Year , Month ,Count(Amount) as Income from
(select b.Name ,a.[Year] as Year ,a.[Month] as Month ,a.Amount as Amount from Test_Amount a left join Test_Users b on a.UserId=b.Id )
c group by Name,Year,Month

posted @ 2016-03-09 18:11  相忘江湖何处去  阅读(130)  评论(0编辑  收藏  举报