Monday, March 13, 2017

how to orderby before groupby cloumns products table and show unique and available products

hello i'v a problem in laravel query:

i wanna to order by before group by of same columns, for example :

Products table

id ....... cat_id ....... color_id ....... count
---------------------------------------------------------
1 ........... 27 ............... 3 ............... 0
2 ........... 27 ............... 7 ................ 3
3 ........... 27 ............... 3 ................ 10
4 ........... 27 ............... 3 ................ 2

now : i wanna down result with first orderby 'count' so groupby 'cat_id,color_id' :

id ....... cat_id ....... color_id ....... count
---------------------------------------------------------
3 ........... 27 ............... 3 ............... 10
2 ........... 27 ............... 7 ................ 3

I hope my problem is resolved Here...

Thanks



via pichanakian

Advertisement