1

我有一个带有 dma 代码的专栏。它们有以下两种格式:

一)100123

b)=“100123”

我正在尝试以 a) 格式获取它们。

我试过使用 NULLIF(regexp_replace(column_name, '\D','','g'), '')::numeric

但我无法使用正确的语法。

0 作为 smart_leads ,0 作为 smart_agent_appointments ,0 作为 smart_oles ,0 作为 phone_enrollment ,0 作为 smart_sales ,0 作为 smart_paid_sales FROM digital.uhg_mr_is_search ds -- IS 活动到源代码映射器 LEFT JOIN uhg_part_b.v_is_search_manual_dims_dedupe search_codes_map ON ds.campaign = search_code。 campaign_name -- 引入州首字母缩写词 -- Yang:请注意,在极少数情况下,我们没有州名,但在原始数据中有 DMA 名称。没有将它们映射到状态,因为我们在 reftables 中没有 dma id 映射器 Campaign = search_codes_map.campaign_name -- 引入州首字母缩写词 -- Yang:请注意,在极少数情况下,我们在原始数据中没有州名但有 DMA 名称。没有将它们映射到状态,因为我们在 reftables 中没有 dma id 映射器 Campaign = search_codes_map.campaign_name -- 引入州首字母缩写词 -- Yang:请注意,在极少数情况下,我们在原始数据中没有州名但有 DMA 名称。没有将它们映射到状态,因为我们在 reftables 中没有 dma id 映射器
左连接 reftables.us_states state_map ON ds.state_name = state_map.state_name 左连接 reftables.zip_dma_map 右连接 zip_map(ds.dma_region_id,3)= zip_map.dma_code -- 左连接 reftables.dcm_dma_map DMA ON dma.dma_code = map.dma_code

WHERE from_date >= '2018-07-01' GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17) GROUP BY 1 ,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17

;

4

1 回答 1

1

为什么不直接使用replace()

select replace(replace(dma, '"', ''), '=') as dma_type_a
于 2019-08-06T21:42:46.590 回答