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 10 * FROM (SELECT TOP 20 tokens.*, t.* FROM [dbo].[survey_678563] [t] LEFT JOIN tokens_678563 tokens ON t.token = tokens.token ORDER BY id asc) as [__inner__] ORDER BY [id] DESC) as [__outer__] ORDER BY [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\models\LSActiveRecord.php(48): CDbCommand->queryAll()
43 
44             $command = $this->getCommandBuilder()->createFindCommand($this->getTableSchema(), $criteria);
45             //For debug, this command will get you the generated sql:
46             //echo $command->getText();
47 
48             return $all ? $command->queryAll() : $command->queryRow();
49         }
50     }
51 
52     /**
53      * Finds all active records satisfying the specified condition but returns them as array
#2
+
 C:\limesurvey_test\application\models\LSActiveRecord.php(64): LSActiveRecord->query(CDbCriteria, true, false)
59      */
60     public function findAllAsArray($condition = '', $params = array())
61     {
62         Yii::trace(get_class($this) . '.findAll()', 'system.db.ar.CActiveRecord');
63         $criteria = $this->getCommandBuilder()->createCriteria($condition, $params);
64         return $this->query($criteria, true, false);  //Notice the third parameter 'false'
65     }
66 }
#3
+
 C:\limesurvey_test\application\controllers\admin\responses.php(522): LSActiveRecord->findAllAsArray(CDbCriteria)
517 
518             $oCriteria->order = 'id ' . (Yii::app()->request->getParam('order') == 'desc' ? 'desc' : 'asc');
519             $oCriteria->offset = $start;
520             $oCriteria->limit = $limit;
521 
522             $dtresult = Survey_dynamic::model($iSurveyID)->findAllAsArray($oCriteria);
523 
524             $dtcount2 = count($dtresult);
525             $cells = $fncount + 1;
526 
527             //CONTROL MENUBAR
2012-12-14 12:23:40 Microsoft-IIS/7.5 Yii Framework/1.1.10