Subquery In Codeigniter Active Records : We sometimes need to write subquery in codeigniter. There are many to write subqueries in codeigniter. The most common question we have here is how to write subqueries in Codeigniter Active Records not the core Queries. Here in this example we are going to explain how you can write subqueries in codeigniter active Recoreds.
Subquery In Codeigniter Active Records
->where() Accepts strings and passes it to the query directly. So we are going to pass subquery in this as below –
Subquery In Codeigniter Active Records Example:
$this->db->select('*')->from('Users'); $this->db->where('id NOT IN (SELECT id FROM profiles where status = "1")', NULL, FALSE); |
The above example will produce the subquery and result as per subquery written.