jeudi 30 mars 2017

How to use group by with multpile columns?

I'm using this query to get data, but problem is that i dont get regions. Any suggestion how can i get regions but to avoid duplicate districts ?

 $data = Districts::distinct('order')->whereRaw('LOWER(district) like ?', [strtolower('%'.$district . '%')])->orWhereRaw('LOWER(region) like ?', [strtolower('%'.$district . '%')])->select('district')->groupBy('district')->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ocwhrR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire