Add EXTERNAL SQL scripts

This commit is contained in:
2026-04-20 14:55:25 +08:00
parent c05ba7ec7e
commit b4979eed82
344 changed files with 61619 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
-- 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