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();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire