06-22-2012, 07:17 PM
[eluser]Unknown[/eluser]
When I try to join with a subquery as a condition, the SELECT statement from that subquery is escaped what leads to a database error.
Example :
Note that SELECT is the only word that is escaped from that subquery.
When I try to join with a subquery as a condition, the SELECT statement from that subquery is escaped what leads to a database error.
Example :
Code:
$this->db->select('*');
$this->db->from('blogs');
$this->db->join('comments', 'comments.id = (SELECT id FROM blogs WHERE ....)');
$query = $this->db->get();
// Produces:
// SELECT * FROM `blogs`
// JOIN `comments` ON `comments`.`id` = (`SELECT` id FROM blogs WHERE ...)
Note that SELECT is the only word that is escaped from that subquery.