表一通过表一该怎么查询成表二的样子
本人是小白啊,想了一个下午都想不到,求帮忙
select sum(胜), sum(负) from (SELECT timda, 胜 =
CASE result
WHEN '胜' then 1
WHEN '败' THEN 0
END,
负 =
CASE result
WHEN '胜' then 0
WHEN '败' THEN 1
END
from 表) group by timada
select sum(胜), sum(负) from (SELECT timeda, 胜 =
CASE result
WHEN '胜' then 1
WHEN '败' THEN 0
END,
负 =
CASE result
WHEN '胜' then 0
WHEN '败' THEN 1
END
from 表) group by timeda
select timeda,sum((case when result = '胜' then 1 else 0 end)) 胜,
sum((case when result = '负' then 1 else 0 end)) 负
from Table_1 group by timeda