Amazon Redshift中相关子查询期间的错误

时间:2018-08-16 14:45:09

标签: amazon-redshift correlated-subquery

我目前面临一个问题,我想在Amazon redshift上运行相关子查询,但收到错误消息“ amazon redshift无效的操作:尚不支持这种类型的相关子查询模式;”

查询如下

   select
      t_1.Offer_ID,
      t_1.LogDate as online_date,
      (
        select t.LogDate
        from
          (
            select
              t_2.LogDate,
              row_number()
              over (
                Order by t_2.LogDate ) as nr_row
            from #temp_offer_log t_2
            where Offer_Status = 'F'
                  and t_2.LogDate > t_1.LogDate /*It runs if I unccoment this line*/
          ) t
        where nr_row = 1
      )                                                                           as offline_date,
      Action                                                                      as Action_Online
      ,cast(Offer_id as CHAR(50)) + '_' + cast(row_number()
                                             over (
                                               Order by t_1.LogDate ) as CHAR(50)) as index_id
    -- into #temp_offer_delta
    from #temp_offer_log t_1

有趣的是,只要我取消注释该行,它便会起作用

t_2.LogDate > t_1.LogDate

但是内容是错误的。有人可以帮忙吗?

THX 拉斯

0 个答案:

没有答案