UPDATE product_sets as a 
	LEFT JOIN glan.product_sets as b on a.glan_id=b.id
	LEFT JOIN glan.sterilizations as c on b.sterilization_id=c.id
	LEFT JOIN glan.common_names as d on b.common_name_id=d.id
	LEFT JOIN (select product_set_id, sales_name from glan.product_models group by product_set_id) as h on a.glan_id=h.product_set_id
SET a.product_category_id=b.product_category_id,
    a.sterilization=c.sterilization_name,
    a.common_name = d.common_name,
    a.precaution = "再使用禁止",
    a.certification_number = b.certification_no,
    a.public_price = b.public_price,
    a.template_file = IF(b.class_risk_id=1, "omkk.mllay", NULL),
    a.maker_name = IF(b.class_risk_id=1, "オーバスネイチメディカル(シンセン)社　中国", NULL),
    a.provider_name = IF(b.class_risk_id=1, "オーバスネイチメディカル株式会社\n東京都渋谷区上原3-6-11 代々木上原ペアシティ",NULL),
    a.class_risk_code = IF(b.class_risk_id=1, 4, 1),
    a.price_unique_code=1,
    a.sales_name = h.sales_name,
    a.supplier_id = IF(b.class_risk_id=1, 2, NULL);

UPDATE product_sets set supplier_id=3 where id=14;
UPDATE product_sets set supplier_id=4 where id=15;

UPDATE product_sets as a
        LEFT JOIN glan.product_sets as b on a.glan_id=b.id
        LEFT JOIN glan.demands as e on b.demand1_id=e.id
        LEFT JOIN glan.demands as f on b.demand2_id=f.id
        LEFT JOIN glan.demands as g on b.demand3_id=g.id
SET a.demands = IF(b.class_risk_id=1, CONCAT(e.demand_name, '\n', f.demand_name , '\n', g.demand_name), "");

UPDATE product_sets as a
        LEFT JOIN glan.product_sets as b on a.glan_id=b.id
        LEFT JOIN glan.demands as e on b.demand1_id=e.id
        LEFT JOIN glan.demands as f on b.demand2_id=f.id
        LEFT JOIN glan.demands as g on b.demand3_id=g.id
SET a.demands = CONCAT(e.demand_name, '\n', f.demand_name) where a.id=9 or a.id=10;


