select a.*,b.* from A表 as a left join B表 as b on a.id = b.id where a.name='lilei' and b.age=27 limit 10 ;
或者tp
$where="自己写"; $limit="自己写";
$result= M('user')->alias('u')
->join('left join ' . C('DB_PREFIX') . 'think_auth_group as t on u.rlid = t.id')
->join('left join ' . C('DB_PREFIX') . 'sale_group_contact as sgc on sgc.uid = u.uid')
->join('left join ' . C('DB_PREFIX') . 'sale_group as sg on sg.sg_id = sgc.sg_id')
->field('u.uid,u.truename,sg.group_name')
->limit($limit)
->where($where)
->select();
例如
(select a,b,c from tablea where author=xxx) union all (select a,b,c tableb where author=xxx) union all (select a,b,c from tablec where author=xxx) limit 1,10;