->where([‘id‘=>35])->field(‘delete_time‘,true)->find();
->field(‘title,email,content‘)->create();
->field(‘id,name,price,0 as is_select‘)
->field(‘id,name,sales_origial_number+sales_actual_number as sales‘)
->field(‘type,round(price) as price,time‘)
->field(‘type,count(id) as type_number‘)->group(‘type‘)->order(‘type_number‘)
->field(status,sum(price) as status_price)->group(status)->order(status_price)
->field(‘count(id) as all_count,sum(star_rank = 1) as goods_review_count,sum(star_rank = 2) as middle_review_count,sum(star_rank = 3) as bad_review_count,sum(has_img = 2) as has_img_count‘)->where($where)->find();
->field(‘count(id) as all_count,IFNULL(SUM(CASE WHEN has_img = 2 THEN 1 END),0) as has_img_count,IFNULL(SUM(CASE WHEN star_rank = 1 THEN 1 END),0) as goods_review_count,IFNULL(SUM(CASE WHEN star_rank = 2 THEN 1 END),0) as middle_review_count,IFNULL(SUM(CASE WHEN star_rank = 3 THEN 1 END),0) as bad_review_count‘)->where($where)->find();
->field("if(substr(sn,1,2)=‘SY‘,1,0) as type")
复制代码
->group(id)->field(‘group_concat(score order by `score ` desc) as score‘)复制代码
->group(‘status‘)->field(‘SUBSTRING_INDEX(group_concat(id order by `id` desc),",",1) as id‘)复制代码
文章转载自 https://www.juchengvi.com/looknews/62