I have two tables. One has order information with an order id, and the other table has order detail information. order_details has multiple rows for each order_id. I’d like a single query that would pull the order information, and then add a ‘column’ for each entry on the order_details table.
Is this possible? And if so, how?
This is not possible in MySQL, or in any SQL that I know of, with the exception of a highly hardcoded query with excessive joins or subqueries.
This type of problem is typically relegated to the domain of programming languages. If you have an ad-hoc need for a query to do this, then something like this would do it (you will have to quote the keyword
order)SQL example: