etrade_shop_1.0.18_data_kangtian.sql 1.54 KB


UPDATE `dili_etrade`.`shop`
SET `selected_district_id` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                `sub_district_id` ELSE `district_id`
            END,
    `selected_district_name` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                `sub_district_name` ELSE `district_name`
            END,
    `district_path` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                CONCAT( `district_id`, ',', `sub_district_id` ) ELSE `district_id`
            END,
    `district_path_name` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                CONCAT( `district_name`, ',', `sub_district_name` ) ELSE `district_name` END
    WHERE selected_district_id IS NULL;




UPDATE `dili_etrade`.`shop_approve`
SET `selected_district_id` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                `sub_district_id` ELSE `district_id`
            END,
    `selected_district_name` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                `sub_district_name` ELSE `district_name`
            END,
    `district_path` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                CONCAT( `district_id`, ',', `sub_district_id` ) ELSE `district_id`
            END,
    `district_path_name` =
        CASE

            WHEN `sub_district_id` IS NOT NULL THEN
                CONCAT( `district_name`, ',', `sub_district_name` ) ELSE `district_name`
            END
    WHERE selected_district_id IS NULL;