I have many rows with the fields name
, unit
, amount
. The rows could be
name, unit, amount
========
Some name, A, 100
Some name, B, 300
Another name, A, 400
I want to select all the rows but grouped by name.
The unit can be either A or B. I want an output as:
name, A_amount, B_amount
============
Some name, 100, 300
Another name, 400, 0
So depending on the unit the amount should either be in A_amount or B_amount.