我通过 Postgresql 连接器使用 Redshift 在 php codeigniter 3.x、php 版本 7.0 中查询时出现以下错误
模型如下
$subQuery = "select max(button_history_id) as button_history_id from button_history
where site_id =".$site_id." group by button_history_id ";
$this->another->select('cms_group_id');
$this->another->from('button_history');
$this->another->where('button_history_id IN ('.$subQuery.")");
$this->another->where('cms_group_id !=', '');
$queryGrp = $this->another->get();
$grpIds = array();
foreach($queryGrp->result_array() as $grps){
if($grps['cms_group_id'])
$grpIds = array_merge($grpIds,explode(',', $grps['cms_group_id']));
}
if($grpIds){
$grpIds = array_unique($grpIds);
$this->another->select('content_history_id, (content_id),content_name,content_type');
$this->another->from('content_history');
$this->another->where_in('content_id',$grpIds);
$this->another->group_by('content_history_id,content_id,content_name,content_type');
$this->another->order_by('content_id ,content_history_id',"desc");
$queryG = $this->another->get();
$result1 = $queryG->result_array();
}
但在值之前附加了不需要的 E',如下所示
错误:类型“e”不存在
SELECT "content_history_id", (content_id), "content_name", "content_type" FROM "content_history" WHERE "content_id" IN( E'358', E'357', E'359', E'361', E'408', E'398', E'362', E'366', E'363') GROUP BY "content_history_id", "content_id", "content_name", "content_type" ORDER BY "content_id" DESC, "content_history_id" DESC
这个 E'358'“E” 造成了所有麻烦,任何人都可以有任何建议,请回复。我对此很陌生,不知道原因是什么,我在下面添加了信息。
PHP版本:7.0
代码点火器:3.x
操作系统:Centos 6.9