(1-2/2)
I found a trick using "GROUP BY" instead of "ORDER BY" but maybe someone need an answer to the question too :)
You can do the following
$option = Option::all(array('select' => 'DISTINCT *', 'joins' => $join));
(1-2/2)
June 27 2010
December 20, 2010 00:00
Subject: Add "DISTINCT" to finder
Hi all,
I'm using PHP 5.3 + mySQL 5.1.31 and I'm looking for how to add a "DISTINCT" to a finder, I would get this query:
SELECT DISTINCT * FROM Options JOIN ...
And I'm using this syntax:
$join = 'JOIN Options_per_Orders ON
(Options.`idoption` = Options_per_Orders.`idoption`) JOIN Orders ON
(Options_per_Orders.`idorder` ='.$order[$i]->idorder.' ) ORDER BY category ASC';
$option = Option::all(array('joins' => $join));
Thank you