yangzailu

导航

左连接sql

<?php
public function sumZong($id){
        $sql ='
            SELECT 
                *
            FROM 
                vvt_league_user AS p
            Left join vvt_league AS r ON p.league_id = r.id
            Left join vvt_league_invest_sum AS n ON r.id = n.league_id
            WHERE 
                p.status = 1
            AND
                r.status = 1   
            AND  
                p.user_id ='. $id
            ;
        $res = $this ->query($sql);
        return $res;
}
?>

 

posted on 2017-09-07 15:24  飞离地平线  阅读(249)  评论(0编辑  收藏  举报