您的位置:首页 > 编程语言 > PHP开发

thinkphp子查询

2015-07-19 00:00 561 查看
直接上代码

$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语句

版权声明:本文为博主原创文章,未经博主允许不得转载。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: