Home > Database > Mysql Tutorial > 复杂的sql语句join的使用(left join,right join)_MySQL

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:44:00
Original
1116 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template