1.在不同表,查询相同字段,通常用union all 连接, select a,b,c from t_a union all select a,b,c from t_b
2.mysql中使用exists语法的时候,子查询中的id需要与外面查询的id相关联:
update t_a a set status = 1 where (select b.id from t_b b where b.id = a. id);
1.在不同表,查询相同字段,通常用union all 连接, select a,b,c from t_a union all select a,b,c from t_b
2.mysql中使用exists语法的时候,子查询中的id需要与外面查询的id相关联:
update t_a a set status = 1 where (select b.id from t_b b where b.id = a. id);