ThinkPHP子查询

$m = D("qipai_logic.roomhisscoredetail");
$where['uid'] = $uid;    
$productinfo = $m->where($where)->field('roomid,uid,name,max(turn) as roomturn')->group('roomid')->buildSql();//子查询 
$allturn = M()->table($productinfo.' a')->field('uid,name,sum(roomturn) allturn')->select();  //总局数

 

posted @ 2018-02-09 15:50  MeetU  阅读(105)  评论(0编辑  收藏  举报