I need to update a table tb0
based on previous CTE statements. The code is similar to the pseudo-code bellow:
with tb1 as(select tb_index from tb0 where tb_index=10),
tb2 as (select tb_index,count(orders))total from orders inner join tb1 on tb1.tb_index=orders.tb_index)
update tb0 set tb0.status='a'
from tb2
inner join tb0.tb_index=tb2.tb_index
where
tb2.total>30
question is, will the update above work considering the inner join and where clause ?