gpt4 book ai didi

snowflake-cloud-data-platform - 雪花 - SQL 编译错误 : Missing column specification

转载 作者:行者123 更新时间:2023-12-03 15:44:17 27 4
gpt4 key购买 nike

我有这个查询:

create table analytics.as_screenings_activity_stopped as (
select
ka.vhost,
ka.SFDC_ACCOUNT_KEY,
ka.count_units,
min(d.go_live_date),
s.RECORD_TYPE_NAME,
s.vplus_stage,
s.screenings_enabled_date,
s.screenings_first_use_date,
sd.most_recent_screen_date,
case when sd.most_recent_screen_date >= dateadd(days, -90, current_date) then 'N' else 'Y' end as last_screen_90_or_more_days_ago

from analytics.key_account_yn as ka
left join analytics.go_live_date as d on ka.SFDC_ACCOUNT_KEY = d.SFDC_ACCOUNT_KEY
left join analytics.screenings_enabled_first_use_date s on ka.SFDC_ACCOUNT_KEY = s.SFDC_ACCOUNT_KEY
left join analytics.most_recent_screen_date sd on ka.vhost = sd.vhost
where ka.key_account_yn = 'Y' and s.vplus_stage = 'Active'
group by
ka.vhost,
ka.SFDC_ACCOUNT_KEY,
ka.count_units,
s.RECORD_TYPE_NAME,
s.vplus_stage,
s.screenings_enabled_date,
s.screenings_first_use_date,
sd.most_recent_screen_date
order by ka.vhost);

当我不尝试创建表时,它运行得很好。我使用的代码格式与我用于其他查询的代码格式相同。我收到以下错误:
SQL compilation error: Missing column specification 

我需要做什么来解决这个问题?
谢谢,
艾丽莎

最佳答案

问题已解决 - 我需要为 min(d.go_live_date) 提供一个别名。感谢 this文章。

更新的查询:

create table analytics.as_screenings_activity_stopped as (
select
ka.vhost,
ka.SFDC_ACCOUNT_KEY,
ka.count_units,
min(d.go_live_date) as go_live_date,
s.RECORD_TYPE_NAME,
s.vplus_stage,
s.screenings_enabled_date,
s.screenings_first_use_date,
sd.most_recent_screen_date,
case when sd.most_recent_screen_date >= dateadd(days, -90, current_date) then 'N' else 'Y' end as last_screen_90_or_more_days_ago

from analytics.key_account_yn as ka
left join analytics.go_live_date as d on ka.SFDC_ACCOUNT_KEY = d.SFDC_ACCOUNT_KEY
left join analytics.screenings_enabled_first_use_date s on ka.SFDC_ACCOUNT_KEY = s.SFDC_ACCOUNT_KEY
left join analytics.most_recent_screen_date sd on ka.vhost = sd.vhost
where ka.key_account_yn = 'Y'
group by
ka.vhost,
ka.SFDC_ACCOUNT_KEY,
ka.count_units,
s.RECORD_TYPE_NAME,
s.vplus_stage,
s.screenings_enabled_date,
s.screenings_first_use_date,
sd.most_recent_screen_date
order by ka.vhost);

关于snowflake-cloud-data-platform - 雪花 - SQL 编译错误 : Missing column specification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56743577/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com