So, lets say I have a table called "imports" that looks like this:
| id | importer_id | total_m | total_f | |====|=============|=========|=========| | 1 | 1 | 100 | 200 | | 1 | 1 | 0 | 200 | And I need the query to return it pivoted or transposed (rows to columns) in this way:
| total_m | sum(total_m) | | total_f | sum(total_f) | I can't think on a way to do this without using another table (maybe a temporary table?) and using unions, but there should be a better way to this anyway (maybe with CASE or IF?).
Thanks in advance.