【问题标题】:sql join no results error in amazon redshift亚马逊红移中的sql加入没有结果错误
【发布时间】:2013-10-30 17:27:12
【问题描述】:

这似乎是我做过无数次的亚马逊红移的简单加入,但它给了我以下错误:

'查询没有返回任何结果。 [SQL 状态=02000]'

这里是sql:

select   
    campaign_id as product_campaign_id,  
    count(*) as sends  
into table_1  
from customer_to_product_campaign  
group by  
    product_campaign_id  
;  

select  
    product_campaign_id,  
    count(*) as opens_total  
into table_2  
from product_action_oc  
where  
    product_action_type_paid = 'open'  
group by   
    product_campaign_id  
;  

select  
    t1.product_campaign_id,  
    t1.sends,  
    t2.opens_total      
into table_3   
from table_1 t1  
left join table_2 t2  
on t1.product_campaign_id = t2.product_campaign_id  

;  

附加信息:
-table 1(创建时没有错误)约为 6K 行
-table 2(创建时没有错误)约为 10K 行
- 这些表确实有共同的 product_campaign_id,但这并不重要

谢谢

【问题讨论】:

    标签: sql postgresql join amazon-web-services amazon-redshift


    【解决方案1】:

    这不是错误,只是一个友好的 Red Shift 通知,表示没有返回到 GUI 的结果。基本上,into 语句会吸收所有结果,因此不会返回任何内容。

    这是一个例子。考虑:

    select *
    into dum
    from (select 1 as col) t;
    

    这会返回相同的通知。但是数据在那里。做吧:

    select *
    from dum;
    

    查看刚刚插入的一行。

    (注意:我刚刚在 Red Shift 上进行了测试。)

    【讨论】:

    • 你完全正确!谢谢!奇怪的是,客户端表现得好像它是一个错误(我认为它以前没有这样做过)并且它声明它是一个错误,'执行 SQL 命令时发生错误:没有返回结果询问。 [SQL 状态 = 02000]'。我以前做过很多次这种类型的加入,我 95% 确定它没有给我这个信息。但正如你所指出的,它有效。再次感谢。
    猜你喜欢
    • 1970-01-01
    • 2013-06-01
    • 2014-04-03
    • 2013-05-26
    • 1970-01-01
    • 2021-02-28
    • 1970-01-01
    • 1970-01-01
    • 2019-02-24
    相关资源
    最近更新 更多