From 9e9cf9a4c213e1a3f4e6c75ce58d6e8cd7ea4d62 Mon Sep 17 00:00:00 2001 From: Geoff Munn Date: Tue, 11 Aug 2009 21:09:31 +0000 Subject: [PATCH] BUGFIX: orderby clause not necessary for simple count queries, and will break MSSQL --- code/FileSubsites.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/FileSubsites.php b/code/FileSubsites.php index 1e20b1f..6934c86 100755 --- a/code/FileSubsites.php +++ b/code/FileSubsites.php @@ -57,7 +57,9 @@ class FileSubsites extends DataObjectDecorator { break; } - $query->orderby = 'SubsiteID' . ($query->orderby ? ', ' : '') . $query->orderby; + if(sizeof($query->select)>1 || $query->select[0]!='COUNT(*)'){ + $query->orderby = 'SubsiteID' . ($query->orderby ? ', ' : '') . $query->orderby; + } } }