bigquery从常量中继续加入

时间:2017-05-15 01:45:09

标签: sql google-bigquery

如何将查询定义为常量并对表进行左连接?

我试图这样做,但它没有工作

#standardSQL
select 
"name" custom_campaign_defined,
"welcome" as funnel_step
from '1' data
left join table on table.campaign = data.custom_campaign_defined

如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

只需使用子查询。它是这样的,虽然引用的列不清楚你到底想要什么:

select t."name" as custom_campaign_defined,
       t."welcome" as funnel_step
from (select '1' as custom_campaign_defined) d left join
     table t
     on t.campaign = d.custom_campaign_defined