thinkphp子查询

来源:互联网 发布:mac系统升级10.12.6 编辑:程序博客网 时间:2024/06/07 06:54

直接上代码

$product_info = M('product_info as info');
$productinfo = $product_info->join('left join c_price_comment as comment on info.sku=comment.sku')->where($where)->order('info.create_time desc')->field('info.*,comment.comment_count')->buildSql();        $list = M()->table($productinfo.' a')->order(' '.$order.'')->group('sku ')->limit($limit)->select();

buildSql方法后不会进行实际的查询操作,而只是生成该次查询的SQL语句

0 0
原创粉丝点击