Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在这样的表中:
有没有办法使用 MySQL 查询直接检索每个国家/地区男性和女性每年总数的数组?
例如:
cittadinanza 1987 1988 1990 ... Afghanistan 13 13 12 ... Albania 22 20 19 ... ... .. .. .. ...
是的,您只需要按国家/地区分组。
SELECT `citidinanza`, SUM(`1987`) as `1987`, SUM( `1988`) AS `1988` FROM `table` GROUP BY `citidinanza`