CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'shoefax_priceapp.scd.created' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by. The SQL statement executed was: SELECT DATE_FORMAT(FROM_UNIXTIME(scd.created), '%V/%Y') as item_date, `scd`.`created`, AVG(scd.price) as avg_price, MAX(scd.price) as max_price, MIN(scd.price) as min_price, COUNT(scd.id) as item_count
FROM `style_code_data` `scd`
JOIN `shoes_style_codes` `ssc` ON ssc.kixify_id=scd.sc_id
WHERE (ssc.clean_style_code=:clean_style_code ) AND (scd.created>=:created)
GROUP BY `item_date`
ORDER BY `scd`.`created` ASC

/var/www/html/yiisystem/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/html/protected/models/StyleCodeData.php(47): CDbCommand->queryAll()
42 //            $command->andWhere('size_name')
43             $params = array(
44                 ':clean_style_code' => $clean_style_code,
45                 ':created' => $one_year
46             );
47             $results = $command->queryAll(true, $params);
48             $points = array();
49 
50             if (!empty($results)) {
51                 foreach ($results as $row) {
52                     if ($data['lowest_price'] == 0) {
#2
+
 /var/www/html/protected/controllers/TagController.php(92): StyleCodeData->getPriceData()
87         $this->cm_ad_options['title'] = $this->cm_ad_options['title'];
88         $this->viewClass = 'content-sidebar';
89         $this->render('tagdetail', array(
90             'model' => $model,
91             'prices' => TagAnalytics::model()->getPriceAnalytics($model->id, strtotime('-6 months')),
92             'sold_prices' => !empty($model->tagInfo->style_code) ? StyleCodeData::model()->getPriceData($model->tagInfo->style_code) : array()
93         ));
94     }
95 
96     public function actionExpensive() {
97         $this->pageTitle = Yii::t('app', 'Most Expensive');
#13
+
 /var/www/html/index.php(11): CApplication->run()
06 
07 $yii = './yiisystem/'.(YII_DEBUG?'yii.php':'yiilite.php');
08 $config = './protected/config/main.php';
09 require_once($yii);
10 Yii::createApplication('CWebApplication', $config);
11 Yii::app()->run(); 
12 
2024-03-19 09:12:02 Apache Yii Framework/1.1.29-dev