Laravel Group By / Order By
Budget: $10 – $30 CAD
\App\Product::selectRaw('id, ROUND((LENGTH(product_unique_id)-LENGTH(REPLACE(product_unique_id, "-", "")))/LENGTH("-")+1) as co, product_unique_id, template_id')
->where('status',1)
->groupBy('template_id')
->whereRaw($whereSku)
->limit(50)
->orderBy('co','ASC')
->get();
I want to get the lowest co item from the group
->where('status',1)
->groupBy('template_id')
->whereRaw($whereSku)
->limit(50)
->orderBy('co','ASC')
->get();
I want to get the lowest co item from the group