我得到以下错误,下面的代码,我没有得到任何错误的另一个数据库,但得到错误的第一个,不知道发生了什么,我使用codeigniter 1x和版本10.1.25-mariadb
发生数据库错误错误号:1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' jp.departmentid ) >0 and FIND_IN_SET( 0, jp.designation ) >0 and FIND_IN_SET( ,' at line 1
SELECT DISTINCT d.id as did, departmentname,GROUP_CONCAT(DISTINCT jp.id) as policy_ids,GROUP_CONCAT(DISTINCT policy_title) as policies FROM `pr_policy` jp INNER JOIN `pr_departments` d ON FIND_IN_SET( d.id, jp.departmentid ) >0 INNER JOIN `pr_designation` des ON FIND_IN_SET( des.id, jp.designation ) >0 LEFT OUTER JOIN `pr_office_branches` o ON FIND_IN_SET( o.id, jp.branchid ) >0 WHERE FIND_IN_SET( , jp.departmentid ) >0 and FIND_IN_SET( 0, jp.designation ) >0 and FIND_IN_SET( , jp.branchid ) >0 group by jp.id,d.id,des.id
Filename: /var/www/html/login/models/mod_common.php
Line Number: 7582
model-modècommon.php函数如下
function get_full_policies_user() { $sql = "SELECT jp.*,jp.id as id,GROUP_CONCAT(DISTINCT d.departmentname) as department,GROUP_CONCAT(DISTINCT des.designation) as designation,jp.create_date,GROUP_CONCAT(DISTINCT o.branchname) as branch,jp.policy_title,jp.create_date
FROM `".$this->myTables['policy']."` jp INNER JOIN `".$this->myTables['department']."` d ON FIND_IN_SET( d.id, jp.departmentid ) >0 INNER JOIN `".$this->myTables['designation']."` des ON FIND_IN_SET( des.id, jp.designation ) >0 LEFT OUTER JOIN `".$this->myTables['office']."`
o ON FIND_IN_SET( o.id, jp.branchid ) >0 "; if($jdid > 0) { $sql .= " where jp.id=".$jdid; } $sql .=" group by jp.id,d.id,des.id"; //echo $sql;die(); $query=$this->db->query($sql); if($query->num_rows() > 0){ $rows = $query->result(); } return $rows;
}
数据库表如附件所示-公共关系单位政策、公共关系单位部门、公共关系单位名称
暂无答案!
目前还没有任何答案,快来回答吧!