2016-10-01 89 views

回答

1

在MySQL中,你會做到這一點使用條件彙總:

select pname, 
     sum(case when weekday = 'Monday' then days else 0 end) as M, 
     . . ., 
     sum(days) as Total 
from t 
group by pname; 

把邏輯在針對平日裏. . .是休息。

+0

謝謝戈登Linoff,這解決並幫助我及時 – user1283333