Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.6 kB
1
Indexable
Never
-- выполняем обновление показателей в отчёте по существующим мастерам
UPDATE dwh.craftsman_report_datamart as crd
SET
    craftsman_name = dur.craftsman_name,
    craftsman_address = dur.craftsman_address,
    craftsman_birthday = dur.craftsman_birthday,
    craftsman_email = dur.craftsman_email,
    craftsman_money = dur.craftsman_money,
    platform_money = dur.platform_money,
    count_order = dur.count_order,
    avg_price_order = dur.avg_price_order,
    avg_age_customer = dur.avg_age_customer,
    median_time_order_completed = dur.median_time_order_completed,
    top_product_category = dur.top_product_category,
    count_order_created = dur.count_order_created,
    count_order_in_progress = dur.count_order_in_progress,
    count_order_delivery = dur.count_order_delivery,
    count_order_done = dur.count_order_done,
    count_order_not_done = dur.count_order_not_done,
    report_period = dur.report_period
FROM (
    SELECT 
        craftsman_id,
        craftsman_name,
        craftsman_address,
        craftsman_birthday,
        craftsman_email,
        craftsman_money,
        platform_money,
        count_order,
        avg_price_order,
        avg_age_customer,
        top_product_category,
        median_time_order_completed,
        count_order_created,
        count_order_in_progress,
        count_order_delivery,
        count_order_done,
        count_order_not_done,
        report_period
    FROM dwh.dwh_delta_update_result
) as dur
WHERE crd.craftsman_id = dur.craftsman_id;
Leave a Comment