左连接查询的思考

 

左连接查询

select  u.Group_Id,u.Group_Name,l.User_Id,l.Position_Id
from usergroup u
left join (select * from UserGroupLink where User_Id='admin' and company_id='000001') as l  on u.Group_Id=l.Group_Id;

as可以省略

 

注意:写成以下这样就不可以了

 

select  u.Group_Id,u.Group_Name,l.User_Id,l.Position_Id
from usergroup u
left join select  * from  (select * from UserGroupLink where User_Id='admin' and company_id='000001') as l  on u.Group_Id=l.Group_Id;

 

你可能感兴趣的:(左连接)