CDbException

CDbCommand не удалось исполнить SQL-запрос: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #2 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'db1082218_advertisement.productspublish.pos' 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 `t`.`id` AS `t0_c0`, `t`.`cid` AS `t0_c1`, `t`.`title` AS `t0_c2`, `t`.`alias` AS `t0_c3`, `t`.`link` AS `t0_c4`, `t`.`link_title` AS `t0_c5`, `t`.`create_time` AS `t0_c6`, `t`.`status` AS `t0_c7`, `t`.`pos` AS `t0_c8`, `t`.`countproduct` AS `t0_c9`, `t`.`order_button` AS `t0_c10`, `t`.`order_text` AS `t0_c11`, `t`.`order_phone_city` AS `t0_c12`, `t`.`order_phone_mobile` AS `t0_c13`, `t`.`order_phone_whatsapp` AS `t0_c14`, `t`.`order_email` AS `t0_c15`, `t`.`order_position` AS `t0_c16`, `t`.`order_insta` AS `t0_c17`, count(productspublish.id) AS bbb FROM `tbl_company_line` `t` LEFT OUTER JOIN `tbl_company_product` `productspublish` ON (`productspublish`.`line_id`=`t`.`id`) WHERE ((t.id IN (:ycp0, :ycp1, :ycp2, :ycp3, :ycp4, :ycp5, :ycp6)) AND ((t.status=1))) AND (productspublish.status=1) GROUP BY t.id ORDER BY bbb DESC, productspublish.pos ASC LIMIT 50

/var/www/vhosts/customer/uralsk24.kz/httpdocs/protected/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

#6
+
 /var/www/vhosts/customer/uralsk24.kz/httpdocs/protected/controllers/CompanyController.php(107): CActiveRecord->findAll(CDbCriteria)
102         $criteria->group = 't.id';
103         $count = CompanyLine::model()->count($criteria);
104         $pages = new CPagination($count);
105         $pages->pageSize = 50;
106         $pages->applyLimit($criteria);
107         $models = CompanyLine::model()->findAll($criteria);
108         
109         $this->render('section',array(
110             'models'=>$models,
111             'pages'=>$pages,
112         ));
#21
+
 /var/www/vhosts/customer/uralsk24.kz/httpdocs/index.php(6): CApplication->run()
1 <?php
2 $yii=dirname(__FILE__).'/protected/framework/yii.php';
3 $config=dirname(__FILE__).'/protected/config/main.php';
4 define('YII_DEBUG', true);
5 require_once($yii);
6 Yii::createWebApplication($config)->run();
2024-03-19 07:51:57 Apache Yii Framework/1.1.12