-- IN SELECT T1.* FROM role_menu T1 WHERE T1.ROLEUUID IN ( SELECT T2.uuid FROM role T2 WHERE T2.UUID = '1' ); -- EXISTS SELECT T1.* FROM role_menu t1 WHERE EXISTS ( SELECT T2.* FROM role T2 WHERE t1.ROLEUUID = T2.uuid AND t2.uuid = '1' );
IN 是结果集中删选数据
EXISTS 是判断是否存在
###
两三个条件使用or
多个使用IN
数据量大使用EXISTS
###