TDCustmerSupportJP Aug 1st, 2017 (edited) 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- SELECT country_name, master_brand.code AS brand_code, master_brand.name AS brand_name, SUM(IF(id IS NOT NULL,1,0)) AS cnt
- FROM usedcar raw
- RIGHT OUTER JOIN
- ( SELECT code, name, country_name FROM brand_master ) master_brand
- raw.code = master_brand.code
- WHERE country_name = 'イギリス'
- GROUP BY country_name, master_brand.code, master_brand.name
- ORDER BY cnt
RAW Paste Data