分享

MySQL 多表左连接

 青_春 2017-02-28
    select u.*, t.*, ub.barracks_level as bl, uh.house_level as hl, us.ware_level as sl, uf.factory_level as fl from t_user u
left join t_title_const t on u.title_id = t.title_id 
left join t_barracks_process ub on ub.up_status = 1 and ub.user_id = u.user_id 
left join t_house_process uh on uh.user_id = u.user_id and uh.up_status = 1 
left join t_storage_process us on us.user_id = u.user_id and us.up_status = 1 
left join t_factory_process uf on uf.user_id = u.user_id and uf.up_status = 1 
where u.user_id = 1          

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多