CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]The column 'token' was specified multiple times for '__inner__'.. The SQL statement executed was: SELECT * FROM (SELECT TOP 100 * FROM (SELECT TOP 200 *
FROM [survey_489924]
LEFT JOIN [tokens_489924] ON tokens_489924.token=survey_489924.token
LEFT JOIN [survey_489924_timings] [survey_timings] ON survey_489924.id = survey_timings.id
ORDER BY [survey_489924].[id]) as [__inner__] ORDER BY [__inner__].[id] DESC) as [__outer__] ORDER BY [__outer__].[id] ASC

C:\limesurvey_test\framework\db\CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#1
+
 C:\limesurvey_test\application\helpers\admin\exportresults_helper.php(326): CDbCommand->query()
321         if ($iOffset+$iLimit>$iMaximum)
322         {
323             $iLimit=$iMaximum-$iOffset;
324         }
325             
326         $survey->responses=$oRecordSet->order('{{survey_' . $survey->id . '}}.id')->limit($iLimit, $iOffset)->query()->readAll();
327 
328         return count($survey->responses);
329     }
330 }
331 
#2
+
 C:\limesurvey_test\application\helpers\admin\exportresults_helper.php(108): SurveyDao->loadSurveyResults(SurveyObj, 100, 100, "523", ...)
103 
104         $iBatchSize=100; $iCurrentRecord=$oOptions->responseMinRecord-1;
105         $bMoreRecords=true; $first=true;
106         while ($bMoreRecords)
107         {
108             $iExported= $surveyDao->loadSurveyResults($survey, $iBatchSize, $iCurrentRecord, $oOptions->responseMaxRecord, $sFilter);
109             $iCurrentRecord+=$iExported;
110             $writer->write($survey, $sLanguageCode, $oOptions,$first);
111             $first=false;
112             $bMoreRecords= ($iExported == $iBatchSize);
113         }
#3
+
 C:\limesurvey_test\application\controllers\admin\export.php(270): ExportSurveyResultsService->exportSurvey("489924", "en", "csv", FormattingOptions, ...)
265         else
266         {
267             $sFilter='';
268         }
269         $resultsService = new ExportSurveyResultsService();
270         $resultsService->exportSurvey($iSurveyID, $explang, $type, $options, $sFilter);
271 
272         exit;
273     }
274 
275     /*
2012-12-14 15:33:15 Microsoft-IIS/7.5 Yii Framework/1.1.10