CodeIgniter Active Records does not currently support subqueries. However, I use the following approach:
#Create where clause $this->db->select('id_cer'); $this->db->from('revokace'); $where_clause = $this->db->_compile_select(); $this->db->_reset_select();
_compile_select () and _reset_select () are two undocumented methods (AFAIK) that compile the query and return sql (without starting it) and reset the query.
In the main FALSE request, the where clause tells codeigniter not to avoid the request (or add backticks, etc.), which would ruin the request. (NULL simply because the where clause has an optional second parameter, which we do not use)
However, you should be aware that _compile_select () and _reset_select () are not documented methods, it is possible that the functionality (or existence) may change in future releases.
mattumotu Jun 03 2018-11-11T00: 00Z
source share