Skip to content
Advertisement

Laravel Eloquent Equivalent for MYSQL DISTINCT query multiple columns

Is there an equivalent query for this in eloquent?

 SELECT DISTINCT agent_code,ord_amount FROM orders

Advertisement

Answer

Try something like this:

Order::select('agent_code', 'ord_amount')->distinct()->get();
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement