I have this table:
+------+--------+-------+
| week | orders | ... |
+------+--------+-------+
| 25 | 15 | ... |
| 26 | 23 | ... |
| 27 | 56 | ... |
| 28 | 34 | ... |
| 29 | 49 | ... |
+------+--------+-------+
And would like to simply make each row in week
become a column like this:
+--------+----+----+----+----+----+
| week | 25 | 26 | 27 | 28 | 29 |
+--------+----+----+----+----+----+
| orders | 15 | 23 | 56 | 34 | 49 |
+--------+----+----+----+----+----+
| ... |... |... |... |... |... |
+--------+----+----+----+----+----+
The query should be able to account for additional weeks, so if a week passes, there should be a new column 30
that corresponds to the 30th week.
I've been trying out different solutions to no avail.