子查询 要用()括起来
实例:
详情表 info( uid, /用户id/
serv_id, /应用服务大类型id/
app_id /应用id/)
用户表 user(uid, /用户id/
uname /用户名/)
应用表 app(id, /应用id/
name /应用名/)
现在要求联表查询用户访问的应用
select tmp.uname,tmp.appname as appname
from info,
( select user.name as uname ,app.name as appname ,info.app_id as app_id
from user,info,app
where user.uid =info.uid and info.app_id = app.id) as tmp
where tmp.app_id = info.app_id;
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/4477.html