select t.id, t.name from t_user_info t where exists (select 1 from t_res_code c where t.id=c.userid)
SQL 2:
select t.id, t.name from t_user_info t where (select count(0) from t_res_code c where t.id=c.userid)>0
...全文
1183打赏收藏
问个exists的问题。。。
其实我就是想弄明白下面两个SQL语句的差别,希望大大们指点指点: SQL 1: select t.id, t.name from t_user_info t where exists (select 1 from t_res_code c where t.id=c.userid) SQL 2: select t.id, t.name from t_user_info t where (select count(0) from t_res_code c where t.id=c.userid)>0