I have this tables:
I need to update sum_ok and avg_ok considering values from table 1 like this:
I have this code SQL, but don't work fine:
update t2 set sum_ok = sum(case when t2.[status]='OK' then 1 else 0 end ) ,avg_ok = avg(case when t2[status]='OK' then status end ) from t1 inner join t2 on t1.A = t2.A --and t1.C = t2.C where C is not null group by A, C Thanks!!


