Result of the query is presented in multiple rows for the same cluster
type, but I would like to have it in one row but multiple columns.
SELECT cluster,pop_group,count(pop_group) as total
FROM gcro_final
WHERE cluster in('A','D','E','H','M')
GROUP BY cluster,pop_group
ORDER BY cluster,pop_group;
Actual result of the query is like this:
+---------+-----------+-------+
| cluster | pop_group | total |
+---------+-----------+-------+
| A | 1 | 153 |
| A | 2 | 1 |
| D | 1 | 258 |
| D | 2 | 1 |
| E | 1 | 204 |
| H | 1 | 49 |
| M | 1 | 13 |
+---------+-----------+-------+
Is it possible to have output like this:
+---------------------+
| A | 1 | 153 | 2 | 1 |
| D | 1 | 258 | 2 | 1 |
| E | 1 | 204 | |
| H | 1 | 49 |
| M | 1 | 13 |
+---------------------+