I have a table, the ID
is not unique per a single row. each ID
can have up to three rows max.
ID | Name | Quantity
----------------------------------------------
1 | apple | 1
1 | orange | NULL
1 | mango | 3
2 | banana | 5
2 | strawberries | 2
3 | kiwi | NULL
3 | lime | 3
3 | grape | 7
I want a query that gets this result table:
| ID | Fruit 1 | Fruit 1 Amount | Fruit 2 | Fruit 2 Amount | Fruit 3 | Fruit 3 Amount
------------------------------------------------------------------------------------------------------------------------------------
| 1 | apple | 1 | orange | NULL | mango | 3
| 2 | banana | 5 | strawberries | 2 | NULL | NULL
| 3 | kiwi | NULL | lime | 3 | grape | 7
I want a row for each ID