diff --git a/classes/expressions/LimeExpressionManager.php b/classes/expressions/LimeExpressionManager.php index f3bdfe2dbe0..56b016a97b8 100644 --- a/classes/expressions/LimeExpressionManager.php +++ b/classes/expressions/LimeExpressionManager.php @@ -7008,6 +7008,8 @@ public static function usingCommaAsRadix() private static function getConditionsForEM($surveyid=NULL, $qid=NULL) { + global $databasetype; + if (!is_null($qid)) { $where = " c.qid = ".$qid." and "; } @@ -7029,8 +7031,18 @@ private static function getConditionsForEM($surveyid=NULL, $qid=NULL) ." from ".db_table_name('conditions')." as c" .", ".db_table_name('questions')." as q" ." where ". $where - ." c.cqid = 0 and c.qid = q.qid" - ." order by sid, qid, scenario, cqid, cfieldname, value"; + ." c.cqid = 0 and c.qid = q.qid"; + + if ($databasetype == 'mssql') + { + $query .= " order by sid, c.qid, scenario, cqid, cfieldname, value"; + + } + else + { + $query .= " order by sid, qid, scenario, cqid, cfieldname, value"; + + } $data = db_execute_assoc($query);