我有以下sql活动记录查询,它给出了这个错误。我有内部选择查询,所以我试图使用我在谷歌上找到的这个方法,但它给出错误,没有定义get_complied_select。如何解决此错误或是否有其他更好的方法来编写以下查询?谢谢!
$this->db->select('id_dem');
$this->db->from('dem_demos');
$this->db->where('id_dem IN (".implode("," ,$id_v).") OR maindemo_dem IN (".implode(",",$id_v).")');
$innermost_query = $this->db->get_compiled_select();
$this->db->select('COUNT(demo_vis) as tot_visits');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N" AND demo_vis IN $innermost_query AND date_vis BETWEEN
".$date_s." AND ".$date_e."');
$first_query = $this->db->get_compiled_select();
$this->db->select('COUNT(demo_vis) as tot_visits');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N"
AND demo_vis IN $innermost_query AND date_vis BETWEEN ".$date_s." AND ".$date_e." AND
invited_vis = 0');
$second_query = $this->db->get_compiled_select();
$this->db->select('COUNT(demo_vis) as tot_visits');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N"
AND demo_vis IN $innermost_query AND date_vis BETWEEN ".$date_s." AND ".$date_e." AND
invited_vis > 0');
$third_query = $this->db->get_compiled_select();
$this->db->select('COUNT(conversion_vis)');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N"
AND demo_vis IN $innermost_query AND date_vis BETWEEN ".$date_s." AND ".$date_e." AND
invited_vis = 0 AND conversion_vis = 1');
$fourth_query = $this->db->get_compiled_select();
$this->db->select('COUNT(buy_vis)');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N"
AND demo_vis IN $innermost_query AND date_vis BETWEEN ".$date_s." AND ".$date_e." AND
buy_vis = 1');
$fifth_query = $this->db->get_compiled_select();
$this->db->select('COUNT(distinct session_vis) as unique_visits');
$this->db->from('sta_views');
$this->db->where('countvisit_wis != "N"
AND demo_vis IN $innermost_query AND date_vis BETWEEN ".$date_s." AND ".$date_e."');
$sixth_query = $this->db->get_compiled_select();
$query = $this->db->select('$first_query as total_views, $second_query as website_views, $third_query as demosent_views,
$fourth_query as website_conversions, $fifth_query as buy_now_clicks, $$sixth_query as unique_views');
if ($query->num_rows() > 0){
return $query->row_array();
}else{
return FALSE;
}