mysql select from multiple table
- by Loon Yew
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