Limited MySQL knowledge. I need to extract related data from multiple tables in a database to a csv/spreadsheet.
Three tables:
- Customers,
- Orders,
- OrderItems
An OrderItem is related to an Order via a unqiue ID. Each Order can have one or more OrderItems.
The Order is related to a Customer via a unique ID. Each customer can have one more more Orders.
I've attempted this query based on the advice below - thanks:
SELECT * FROM user u
JOIN order o
ON u.id = o.userid
JOIN orderarticles a
ON o.id = a.orderid;
However, getting an error:
Duplicate column name 'OXID'
I cannot change the field names/structure. How can I resolve this?
I want a spreadsheet containing all the customers, with their associated purchase history. Time or payment is not so important as simply knowing what each customer purchased.
Looking forward to some pro tips!