带有子查询语法错误的redshift更新查询

时间:2018-10-22 14:44:05

标签: sql sql-update amazon-redshift

update ca_ger.cln_trans_base 
    set stock_age=cast(week_starting)-b.min_date 
from (
  select pon+season_code as p,min(cast(week_starting as date)) as min_date 
  from ca_ger.cln_trans_base a 
  where a.gross_sales_value>0 
    and aseason_code!='0' 
  group by pon+season_code
) as b;

上述语法有什么问题?

1 个答案:

答案 0 :(得分:0)

这是问题cast(week_starting)。您需要将其投射为某种东西。