根据关联查询select数据结果,想根据结果直接进行update更新数据失效状态
- 查询数据
with temp_a as (
//查询数据
),temp_b as (
select * from temp_a where d_code in ('uuid_table_name')
) select a.rule_name, a.invalid from s_rule a
join temp_b on a.id = temp_b.rule_id
- 更新数据
with temp_a as (
//查询数据
),temp_b as (
select * from temp_a where d_code_tf in ('uuid_table_name')
) update s_rule a
join temp_b on a.id = temp_b.rule_id
set a.invalid=1