这个应该是视图的原因,换成实体表是可以的,视图sql如下
CREATE VIEW V_rm_pdb_data_campaign_group_deal_bind
AS SELECT a
.prefix
AS prefix
, a
.key
AS key
, a
.value
AS value
, a
.create_by
AS create_by
, a
.update_by
AS update_by
, a
.create_time
AS create_time
, a
.is_delete
AS is_delete
, a
.is_delete_from_cache
AS is_delete_from_cache
, a
.ad_type_id
AS ad_type_id
, a
.ad_style_id
AS ad_style_id
, a
.media_type
AS media_type
, a
.placement
AS placement
, a
.position_id
AS position_id
, a
.position
AS position
, a
.market
AS market
, a
.start_time
AS start_time
, a
.end_time
AS end_time
, a
.trans_type
AS trans_type
, a
.order_id
AS order_id
, a
.meid
AS meid
, b
.region_name
AS region_name
, b
.position_name
AS position_name
, b
.brand_Id
AS brand_id
, b
.brand_name
AS brand_name
, b
.product_id
AS product_id
, b
.product_name
AS product_name
, b
.campaign_platform_name
AS campaign_platform_name
FROM (SELECT prefix
AS prefix
, key
AS key
, value
AS value
, create_by
AS create_by
, update_by
AS update_by
, create_time
AS create_time
, is_delete
AS is_delete
, is_delete_from_cache
AS is_delete_from_cache
, ad_type_id
AS ad_type_id
, ad_style_id
AS ad_style_id
, media_type
AS media_type
, placement
AS placement
, position_id
AS position_id
, position
AS position
, market
AS market
, start_time
AS start_time
, end_time
AS end_time
, trans_type
AS trans_type
, if(substring(value
, 1, 1) = ‘[’, split_part(replace(replace(substring(value
, 2), ‘"’, ‘’), ‘]’, ‘’), ‘,’, 1), value
) AS order_id
, CASE WHEN key
LIKE ‘%_mobile%’ THEN replace(replace(key
, prefix
, ‘’), ‘_mobile’, ‘’) WHEN key
LIKE ‘%_pc%’ THEN replace(replace(key
, prefix
, ‘’), ‘_pc’, ‘’) WHEN key
LIKE ‘%_ott%’ THEN replace(replace(key
, prefix
, ‘’), ‘_ott’, ‘’) ELSE replace(key
, prefix
, ‘’) END AS meid
FROM (SELECT key
AS key
, value
AS value
, create_by
AS create_by
, update_by
AS update_by
, create_time
AS create_time
, is_delete
AS is_delete
, prefix
AS prefix
, is_delete_from_cache
AS is_delete_from_cache
, ad_type_id
AS ad_type_id
, ad_style_id
AS ad_style_id
, media_type
AS media_type
, placement
AS placement
, position_id
AS position_id
, position
AS position
, market
AS market
, start_time
AS start_time
, end_time
AS end_time
, trans_type
AS trans_type
FROM default_cluster:starRocks
.rm_pdb_data_campaign_group_deal_bind
UNION SELECT key
AS key
, value
AS value
, create_by
AS create_by
, update_by
AS update_by
, create_time
AS create_time
, is_delete
AS is_delete
, prefix
AS prefix
, is_delete_from_cache
AS is_delete_from_cache
, ad_type_id
AS ad_type_id
, ad_style_id
AS ad_style_id
, media_type
AS media_type
, placement
AS placement
, position_id
AS position_id
, position
AS position
, market
AS market
, start_time
AS start_time
, end_time
AS end_time
, trans_type
AS trans_type
FROM default_cluster:starRocks
.rm_pdb_data_deal_bind
) wer) a LEFT OUTER JOIN default_cluster:starRocks
.rmos_order
b ON a
.order_id
= b
.order_id
;