将数据库从 MySQL 更改为 MySQLI 并收到错误 - 发生数据库错误
错误号:1055
SELECT 列表的表达式 #23 不在 GROUP BY 子句中,并且包含在功能上不依赖于 GROUP BY 子句中的列的非聚合列 'zipbizzlatestdb.pia.id';这与 sql_mode=only_full_group_by 不兼容
SELECT *,o.id as id, GROUP_CONCAT(pia.applicantid) as applicants
FROM `pr_opportunity` as o
LEFT OUTER JOIN pr_internal_applicant as pia
ON o.id = pia.positionid
WHERE o.approval_status='Approved'
and DATE(o.deadline) > DATE(NOW())
GROUP BY o.id
文件名:/var/www/html/singlecodebase/Feb152017/models/mod_common.php
行号:6999
我的模型文件 mod_common 如下:
function get_opportunity_list()
{
$sql = "SELECT *,o.id as id, GROUP_CONCAT(pia.applicantid) as applicants
FROM `".$this->myTables['opportunity']."` as o
LEFT OUTER JOIN pr_internal_applicant as pia
ON o.id = pia.positionid
WHERE o.approval_status='Approved'
and DATE(o.deadline) > DATE(NOW())
GROUP BY o.id";
$query=$this->db->query($sql);
if($query->num_rows() > 0){
$rows = $query->result();
}
return $rows;
}
不知道如何解决这个错误