I am learning SQL and I am looking at SQL joins at the moment. Playing around with different joins in MySQL and I was wondering if this would be possible, to have it all in 1 column.
DB has 3 tables:
- shops
- prices
- products
Products looks like:
- product_id
- product_name
Shops looks like:
- shop_id
- shop_name
Prices look like:
- price_id
- price_amount
- product_id
- shop_id
So the big question is: is it possible to combine it to have it output like: product_id,product_name,price_shop1,price_shop2,price_shop3
I got so far that my output is like product_id,price_amount,shop_id,shop_name, but on 3 different rows.
Can it be done? What kind of join am I looking for if it is possible?
I do not see where I could be using this, just trying to learn.
Thanks.
Regards, Mike