首頁 > 資料庫 > 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
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板