私はmysqlに関する知識を得ようとしています
mysql> SELECT species, sex, COUNT(*) FROM pet
-> WHERE species = 'dog' OR species = 'cat'
-> GROUP BY species, sex;
+---------+------+----------+
| species | sex | COUNT(*) |
+---------+------+----------+
| cat | f | 1 |
| cat | m | 1 |
| dog | f | 1 |
| dog | m | 2 |
+---------+------+----------+
手に入れることは可能ですか?
+---------+-----------+-------------+
| species | malecount | femalecount |
+---------+-----------+-------------+
| cat | 1 | 1 |
| dog | 1 | 2 |
+---------+-----------+-------------+
単一のクエリで?