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;
что может быть не так с приведенным выше синтаксисом?