Would like to ask how can I get this result?
Each id_item
only has two rows of data. Need to merge same id_item
rows to different column (IN and OUT), including date and qty
.
My current data:
id_transaction | id_item | item_name | brand | type | qty | date |
---|---|---|---|---|---|---|
4 | 83 | Glass Wine | XYZ | IN | 100 | 2023-01-01 |
4 | 84 | Plastic Cup | IKEA | IN | 50 | 2023-01-01 |
5 | 83 | Glass Wine | XYZ | OUT | 10 | 2023-03-20 |
Expected result:
id_item | item_name | brand | IN | date | OUT | date |
---|---|---|---|---|---|---|
83 | Glass Wine | XYZ | 100 | 2023-01-01 | 10 | 2023-03-20 |
84 | Plastic Cup | IKEA | 50 | 2023-01-01 | 0 | N/A |
5