CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'cate_id' in group statement is ambiguous. The SQL statement executed was: SELECT `t`.`cate_id` AS `t0_c3`, `t`.`id` AS `t0_c0`, `cate`.`id` AS `t1_c0`, `cate`.`cate_id` AS `t1_c1`, `cate`.`parent_id` AS `t1_c2`, `cate`.`path` AS `t1_c3`, `cate`.`child_id` AS `t1_c4`, `cate`.`all_child_id` AS `t1_c5`, `cate`.`cate_name` AS `t1_c6`, `cate`.`root_cate_name` AS `t1_c7`, `cate`.`url_cate_name` AS `t1_c8`, `cate`.`url_root_cate_name` AS `t1_c9`, `cate`.`hot` AS `t1_c10`, `cate`.`status` AS `t1_c11`, `company`.`id` AS `t2_c0`, `company`.`companyname` AS `t2_c1`, `company`.`logo` AS `t2_c2`, `company`.`businesstype` AS `t2_c3`, `company`.`yearestablished` AS `t2_c4`, `company`.`markets` AS `t2_c5`, `company`.`othermarkets` AS `t2_c6`, `company`.`uid` AS `t2_c7`, `company`.`employees` AS `t2_c8`, `company`.`capital` AS `t2_c9`, `company`.`brand` AS `t2_c10`, `company`.`tasvolume` AS `t2_c11`, `company`.`exportper` AS `t2_c12`, `company`.`tapvolume` AS `t2_c13`, `company`.`bankdetails` AS `t2_c14`, `company`.`factorysize` AS `t2_c15`, `company`.`factorylocation` AS `t2_c16`, `company`.`qaqc` AS `t2_c17`, `company`.`productionlines` AS `t2_c18`, `company`.`rdstaff` AS `t2_c19`, `company`.`qcstaff` AS `t2_c20`, `company`.`contract` AS `t2_c21`, `company`.`oemservices` AS `t2_c22`, `company`.`qualitycontrol` AS `t2_c23`, `company`.`rd` AS `t2_c24`, `company`.`servicessupport` AS `t2_c25`, `company`.`adver_photo` AS `t2_c26`, `company`.`companyprofile` AS `t2_c27`, `company`.`ceo` AS `t2_c28`, `company`.`website` AS `t2_c29`, `company`.`type` AS `t2_c30`, `company`.`phone` AS `t2_c31`, `company`.`fax` AS `t2_c32`, `company`.`country` AS `t2_c33`, `company`.`state` AS `t2_c34`, `company`.`city` AS `t2_c35`, `company`.`street` AS `t2_c36`, `company`.`approved` AS `t2_c37`, `company`.`featured` AS `t2_c38`, `company`.`viewed` AS `t2_c39`, `company`.`new` AS `t2_c40`, `company`.`flag` AS `t2_c41`, `company`.`bossgoo_id` AS `t2_c42`, `company`.`status` AS `t2_c43`, `company`.`created_at` AS `t2_c44`, `company`.`updated_at` AS `t2_c45`, `member`.`id` AS `t3_c0`, `member`.`username` AS `t3_c1`, `member`.`email` AS `t3_c2`, `member`.`country` AS `t3_c3`, `member`.`phone` AS `t3_c4`, `member`.`fax` AS `t3_c5`, `member`.`cate_id` AS `t3_c6`, `member`.`memtype` AS `t3_c7`, `member`.`fburl` AS `t3_c8`, `member`.`twurl` AS `t3_c9`, `member`.`yturl` AS `t3_c10`, `member`.`lkurl` AS `t3_c11`, `member`.`pinurl` AS `t3_c12`, `member`.`gpurl` AS `t3_c13`, `member`.`insurl` AS `t3_c14`, `member`.`bossgoo_id` AS `t3_c15`, `member`.`status` AS `t3_c16`, `member`.`created_at` AS `t3_c17`, `member`.`updated_at` AS `t3_c18`, `member`.`expired_at` AS `t3_c19`, `member`.`gold_started_at` AS `t3_c20` FROM `ph_kqzsw_com_photoes` `t` LEFT OUTER JOIN `ph_kqzsw_com_cate_show` `cate` ON ((cate.cate_id = t.cate_id) AND (t.status=1)) LEFT OUTER JOIN `ph_kqzsw_com_companyprofiles` `company` ON ((company.uid = t.uid AND company.status=1) AND (t.status=1)) LEFT OUTER JOIN `ph_kqzsw_com_members` `member` ON ((member.id = t.uid AND member.status=1) AND (t.status=1)) WHERE (t.status=1) GROUP BY cate_id ORDER BY updated_at desc LIMIT 5

/srv/http/yii/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
+
 /srv/http/virtual/photo/protected/models/BaseAR.php(19): CActiveRecord->findAll(CDbCriteria, array())
14         $Dbcache->keyPrefix = $this->getTablePrefix();
15         $tmps = $params;
16         $tmps[] = $condition;
17         $DbcacheKey = get_class($this) . json_encode($tmps);
18         if ($Dbcache->get($DbcacheKey) === false) {
19             $rs = parent::findAll($condition, $params);
20             $Dbcache->set($DbcacheKey, $rs, $this->cacheTime);
21         } else {
22             $rs = $Dbcache->get($DbcacheKey);
23         }
24         return $rs;
#7
+
 /srv/http/virtual/photo/protected/models/Photoes.php(233): BaseAR->findAll(CDbCriteria)
228             $old_limit=$criteria->limit;
229             $criteria->limit=1000%$old_limit;
230             $criteria->offset=1000 -(1000%$old_limit);
231         }
232 
233         return self::model()->with($relations)->findAll($criteria);
234     }
235 }
236 
237 ?>
#8
+
 /srv/http/virtual/photo/protected/components/ViewExportMethods.php(269): Photoes::getListByCri(CDbCriteria)
264         $criteria->limit=$sum;
265         $criteria->group='cate_id';
266         $criteria->select='cate_id';
267         $criteria->order='updated_at desc';
268 
269         $photo_list=Photoes::getListByCri($criteria);
270         if(count($photo_list)<1){
271             return [];
272         }
273         
274         $id_list='';
2024-03-28 16:53:08 nginx/1.18.0 Yii Framework/1.1.12