I have two tables
orders - id - created_at - paid_at items - id - title - amount - quantity - order_id
Let say that there are 3 kinds of items. Chair, table and door.
I would like to create a query that will produce table with following columns:
- order_id - created_at - paid_at - item_id # for chair - item_title - item_quantity - item_amount - item_id # for table - item_title - item_quantity - item_amount - item_id # for door - item_title - item_quantity - item_amount
If order has chair item, data in columns for chair will be displayed otherwise it will be empty.
Why am I doing this?
I would like to export this data to excel sheet.
There is limited amount of different items so there is no problem with milions of columns.