34,591
社区成员
发帖
与我相关
我的任务
分享
WHERE year_born IN(1965,1966);
SELECT case when year_born=1966 then Count(id) end AS '1966',
case when year_born=1965 then Count(id) end AS '1965'
FROM person
所有的行转列,列转行,都是用case when
select sum(case when year_born=1965 then 1 else 0 end) as "1965",
sum(case when year_born=1966 then 1 else 0 end) as "1966"
from person