CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column 'venturepact_db.t.order' which is not in SELECT list; this is incompatible with DISTINCT. The SQL statement executed was: SELECT DISTINCT company_name FROM `suppliers_has_portfolio` `t` WHERE (t.status = :status and t.suppliers_id = :supplierid and t.portfolio_type=0) AND (t.status IN (:ycp62, :ycp63)) ORDER BY t.order LIMIT 5. Bound with :status='1', :supplierid='552', :ycp62='1', :ycp63='2'

/home/venturepact/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

#3
+
 /home/venturepact/public_html/protected/controllers/SiteController.php(1434): CActiveRecord->findAll(CDbCriteria)
1429         $criteria->params = array(":status" => "1",":supplierid"=>$supplier->id);
1430         $criteria->addInCondition("t.status", array("1", "2"));
1431         $criteria->distinct=true;
1432          $criteria->select = 'company_name';
1433          $criteria->limit    =    5;
1434         $Portfolioclient    =  SuppliersHasPortfolio::model()->findAll($criteria);
1435         /*ends here*/
1436         // fetch criteria for testimonials
1437         unset($criteria);
1438         $criteria = new CDbCriteria;
1439         $criteria->join ='LEFT JOIN suppliers_has_portfolio ON suppliers_has_portfolio.id = t.suppliers_has_portfolio_id';
#11
+
 /home/venturepact/public_html/protected/controllers/SiteController.php(20): CFilterChain->run()
15         );
16     }
17 
18     public function filterSetCookieSession($filterChain) {
19         $this->cookieLoginLinkedIn();
20         $filterChain->run();
21     }
22 
23     public function actions()
24     {
25         return array(
#19
+
 /home/venturepact/public_html/index.php(18): CApplication->run()
13 defined('YII_DEBUG') or define('YII_DEBUG',true);
14 // specify how many levels of call stack should be shown in each log message
15 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
16 
17 require_once($yii);
18 Yii::createWebApplication($config)->run();
2024-03-19 02:20:30 Apache Yii Framework/1.1.15-dev