CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'attribute1'. The SQL statement executed was: SELECT `p`.*, `luser`.`full_name` AS `ownername`, `luser`.`users_name` AS `username`, (SELECT count(*) survey
FROM `lime_survey_links` `sl`
WHERE sl.participant_id = p.participant_id) survey, `attributem`.`value` AS `am`, `attribute1`.`value` AS `a1`, `attribute1`.`value` AS `a1`, `attribute1`.`value` AS `a1`, `attribute1`.`value` AS `a1`, `attribute1`.`value` AS `a1`
FROM `lime_participants` `p`
left join lime_users luser ON luser.uid=p.owner_uid
LEFT JOIN lime_participant_attribute attributem ON attributem.participant_id=p.participant_id AND attributem.attribute_id=m
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1

/var/www/cardsurveys/limesurvey205plus-build/framework/db/CDbCommand.php(543)

531         {
532             if($this->_connection->enableProfiling)
533                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
534 
535             $errorInfo=$e instanceof PDOException ? $e->errorInfo : null;
536             $message=$e->getMessage();
537             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
538                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
539 
540             if(YII_DEBUG)
541                 $message.='. The SQL statement executed was: '.$this->getText().$par;
542 
543             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
544                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
545         }
546     }
547 
548     /**
549      * Builds a SQL SELECT statement from the given query specification.
550      * @param array $query the query specification in name-value pairs. The following
551      * query options are supported: {@link select}, {@link distinct}, {@link from},
552      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
553      * {@link limit}, {@link offset} and {@link union}.
554      * @throws CDbException if "from" key is not present in given query parameter
555      * @return string the SQL statement

Stack Trace

#1
+
 /var/www/cardsurveys/limesurvey205plus-build/application/models/Participant.php(253): CDbCommand->queryAll()
248 
249     function getParticipants($page, $limit,$attid, $order = null, $search = null, $userid = null)
250     {
251         $data = $this->getParticipantsSelectCommand(false, $attid, $search, $userid, $page, $limit, $order);
252         
253         $allData = $data->queryAll();
254 
255         return $allData;
256     }
257     
258     /**
#2
+
 /var/www/cardsurveys/limesurvey205plus-build/application/controllers/admin/participantsaction.php(105): Participant->getParticipants(0, 0, array("multiselect-all", "13", "14", "15", ...), null, ...)
100             $iUserID = null;
101         } else {
102             $iUserID = Yii::app()->session['loginID'];
103         }
104 
105         $query = Participant::model()->getParticipants(0, 0, $aAttributeIDs, null, $search, $iUserID);
106         if (!$query)
107             return false;
108 
109         // Field names in the first row
110         $fields = array('participant_id', 'firstname', 'lastname', 'email', 'language', 'blacklisted', 'owner_uid');
#3
+
 /var/www/cardsurveys/limesurvey205plus-build/application/controllers/admin/participantsaction.php(744): participantsaction->csvExport(null, array("multiselect-all", "13", "14", "15", ...))
739             $search = Participant::model()->getParticipantsSearchMultipleCondition($condition);
740         } else {
741             $search = null;
742         }
743         $aAttributes=explode('+',Yii::app()->request->getPost('attributes',''));
744         $this->csvExport($search,$aAttributes);
745     }
746 
747     /**
748      * Equal to getParticipants_json() but now with a search
749      */
2014-04-04 13:31:59 Apache Yii Framework/1.1.14