mysql select from multiple table

Posted by Loon Yew on Stack Overflow See other posts from Stack Overflow or by Loon Yew
Published on 2010-03-31T08:35:17Z Indexed on 2010/03/31 8:43 UTC
Read the original article Hit count: 282

Filed under:

I have 3 tables with values like below tbl_product recID pID price colour 1 BDPLA-0001 1.23 White 2 BDPLA-0002 2.23 Black 3 BDPLA-0003 2.28 Blue

tbl_product_size recID pID size stock
1 1 2.0cm 10 2 1 3.0cm 20 3 2 2.5cm 30 4 3 3.6cm 40 5 3 3.8cm 50

tbl_order_details recID pID quantity size 201 BDPLA-0001 5 2.0cm 202 BDPLA-0002 10 2.5cm

tbl_product.recID = tbl_product_size.pID tbl_product.pID = tbl_order_details.pID

how can i combine the tables and produce result like this pID size stock quantity price BDPLA-0001 2.0cm 10 5 1.23 BDPLA-0001 3.0cm 20 null 1.23 BDPLA-0002 2.5cm 30 10 2.23 BDPLA-0003 3.6cm 40 null 2.28 BDPLA-0003 3.8cm 50 null 2.28

© Stack Overflow or respective owner

Related posts about mysql