I'd like to pivot a table without using any PIVOT function but using pure SQL only (let's say PostgreSQL syntax for example).
So having this data-set as an example:
Order | Element | Value |
---------------------------
1 | Item | Bread |
1 | Quantity | 3 |
1 | TotalCost | 3,30 |
2 | Item | Pizza |
2 | Quantity | 2 |
2 | TotalCost | 10 |
3 | Item | Pasta |
3 | Quantity | 5 |
3 | TotalCost | 2,50 |
I'd expect to pivot on the Order column and having somenthing like:
Order | Item | Quantity | TotalCost |
-------------------------------------
1 | Bread | 3 | 3,30 |
2 | Pizza | 2 | 10 |
3 | Pasta | 5 | 2,50 |
How would I achieve that, once again, without using any pivot function?