且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将非重复计数SQL查询转换为Laravel口才查询

更新时间:2023-09-18 23:41:04

检查此查询

$count = Set::select('article_id as assigned');
if(!empty($action_id)){
   $count = $count->where('action_id', $action_id); 
}
if(!empty($set_id)){
   $count = $count->where('set_id', $set_id); 
}
$count = $count->distinct('article_id')->count('article_id');