Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT ba.*
- FROM brand_all_prices bap
- LEFT JOIN brand_all ba1 ON ba1.id = bap.parent_id
- LEFT JOIN brand_all ba2 ON ba2.parent_id = ba1.id
- AND ba2.should_use_own_name = 1
- LEFT JOIN brand_all ba ON ba.id = IFNULL(ba2.id, ba.id)
- WHERE bap.BRAND = "BMW / MINI";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement