丿潇湘丶书笛的博客在数据库查询中,用查询结果A来反查某个数据库表中的数据B,是一个常见的操作;...select * from tablename1 where c_cityin ( select c_city fromtablename2 where c_id='0211' ) as a 我在一些简单的数据...
JackMa_的博客mysql会把in子查询转换成exists相关子查询,所以它实际等同于这条sql语句:select * from a where exists(select * from b where b.id=a.id ); 而exists相关子查询的执行原理是: 循环取出a表的每一条记录与b表进行...