table
- $list = M()->table(‘user1 a, user2 b‘)->where(‘a.id = b.id‘)->field(‘a.name,b.sex‘)->order(‘a.id desc‘)->select();
join
- $pre = C(‘DB_PREFIX‘);
- M("user u")->join("{$per}user_info x ON x.uid = u.id")->where("u.id = $uid")->find();
另外,两个表中若有同名字段都要查询的话,用这样的写法: filed(‘a.*,b.name as username,b.sex‘)
记录官网的一篇教程