From: Alan Knowles Date: Thu, 11 Nov 2010 11:09:03 +0000 (+0800) Subject: Pman/Roo.php X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=4d8f253d05c11da7e6ef41d4a42e96a1a7f20369;p=Pman.Base Pman/Roo.php --- diff --git a/Pman/Roo.php b/Pman/Roo.php index c1e2580..b509c5c 100644 --- a/Pman/Roo.php +++ b/Pman/Roo.php @@ -667,22 +667,20 @@ class Pman_Roo extends Pman $do->selectAdd(); // we need thsi as normally it's only cleared by an empty selectAs call. $selectAs = array(array( $xx , '%s')); - + $has_distinct = false; if ($filter) { $cols = array(); - $has_distinct = false; + foreach($xx as $c) { if ($distinct && $distinct == $c) { - $has_distinct=$c; + $has_distinct = 'DISTINCT( ' . $do->tableName() .'.'. $has_distinct .' as ' . $has_distinct ; continue; } if (in_array($c, $filter)) { $cols[] = $c; } } - if ($has_distinct) { - $do->selectAdd( 'DISTINCT( ' . $do->tableName() .'.'. $has_distinct .' as ' . $has_distinct ); - } + $selectAs = array(array( $cols , '%s')); }