Files
MarketAnalysis-ETL/14 dm_tf_external_retail_special_bkp.sql
2026-04-27 11:04:09 +08:00

22 lines
710 B
SQL

-- Databricks notebook source
insert overwrite table dm.dm_tf_external_retail_special
--dtp 部分的数据 EGFR TKI 需要直取
select
case when a.market = 'EGFR TKI' then 'EGFR TKI Market' else a.market end as market
,a.province_city
,a.audit_key
,a.audit_source
,a.date_key
,a.yyyymm
,a.sales_value
,a.sales_volume
,a.pdot_counting_unit
,c.sales_value sales_value_ly
,c.sales_volume sales_volume_ly
,c.pdot_counting_unit pdot_counting_unit_ly
,'dtp' `source`
from dws.dws_tf_external_retail_dtp_special a
left join dws.dws_tf_external_retail_dtp_special c --取去年同期数据
on a.province_city = c.province_city
and a.market = c.market
and (a.yyyymm-100) = c.yyyymm