两个相似SQL的查询结果,以前未曾注意
select a.*, case when x.resno is null then 0 else 1 end as isown from prm_res a
left join
(select b.resno from prm_res b
inner join prmg_role_res c on b.resno=c.resno
inner join prmg_acct_role d on d.roleno=c.roleno and d.acct=1
) as x
on a.resno=x.resno where a.sysno=1;
select a.*, case when x.resno is null then 0 else 1 end as isown from prm_res a
left join
(select b.resno from prm_res b
inner join prmg_role_res c on b.resno=c.resno
inner join prmg_acct_role d on d.roleno=c.roleno and d.acct=1
) as x
on a.resno=x.resno and a.sysno=1;
本文转自 leizhimin 51CTO博客,原文链接:http://blog.51cto.com/lavasoft/1941135,如需转载请自行联系原作者