现有一个student表结构数据如下:
现在需要查出 age=16、17、18的学生的数量。
解决方法:
SELECT id, sum(age= '16') AS age16, sum(age= '17') as age17 FROM student ORDER BY age DESC