我一直在使用子查询库 - Subquery.php 参考:https ://github.com/NTICompass/CodeIgniter-Subqueries
$this->db->select('test');
$this->db->select('test2');
$this->db->from('table');
$sub = $this->subquery->start_subquery('where_in');
$sub->select('IDs');
$sub->from('idTable');
$sub->where('date', '2011-07-10');
$this->subquery->end_subquery('id');
我认为这种说法:
$sub = $this->subquery->start_subquery('where_in');
包含错误。当我执行这一行时,我得到一个空白页。fn。start_subquery 是:
function start_subquery($statement, $join_type = '', $join_on = 1){
$db = $this->CI->load->database('', true); // after executing this statement, a blank page shows...
$this->dbStack[] = $db;
$this->statement[] = $statement;
if(strtolower($statement) == 'join'){
$this->join_type[] = $join_type;
$this->join_on[] = $join_on;
}
return $db;
}
仅供参考 - 在我的 database.php 中:
$active_group = 'default'
$active_record = TRUE;
CI版本是2.1.0