php - retrieve data from 4 tables -
i have these 4 table assume ring table consist of 5 fields(jewelry_id,ring_id,image,type,brand_id)
note brand table have foreign key in ring table , ring , style both have foreign keys in ring_style table. want retrieve following data these 4 table (ring_id, image,type, brand,style) did't query appreciated.
select ring_id, image, type, brand, style ring left join brand on ring.brand_id = brand.brand_id left join ring_style on ring.jewelry_id = ring_style.jewelry_id left join style on ring_style.style_id = style.style_id
note each ring appear 1 or more times. appear more 1 time when there more 1 ring_style
record ring.
Comments
Post a Comment