首页 > 数据库 > mysql教程 > 复杂的sql语句join的使用(left join,right join)_MySQL

复杂的sql语句join的使用(left join,right join)_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-01 13:44:00
原创
1117 人浏览过

bitsCN.com SELECT u.*,count(u.id) AS sum
02
                    FROM user AS u
03
                    LEFT JOIN post AS p
04
                    ON p.user_id = u.id
05
                    RIGHT JOIN user_has_group as up
06
                    ON up.user_id = u.id
07
                    RIGHT JOIN user_has_email as ue
08
                    ON ue.user_id = u.id
09
                    WHERE u.username != ''
10
                    AND up.group_id = {$args['groupid']}
11
                    AND ue.email = '{$args['useremail']}'
12
                    GROUP BY u.id ORDER BY u.id desc bitsCN.com

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板