CodeIgniter Forums
Help - me ! Sql - codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Help - me ! Sql - codeigniter (/thread-54118.html)



Help - me ! Sql - codeigniter - El Forum - 08-23-2012

[eluser]Junhinhow[/eluser]
Hi, I wonder how this code in Sql, works in CodeIgniter, I thank all who can help!

SELECT *
FROM equipamentos_splitter_cor WHERE NOT EXISTS(SELECT* FROM equipamentos_splitter_cor_cliente
WHERE equipamentos_splitter_cor_cliente.equipamentos_splitter_cor_id = equipamentos_splitter_cor.id AND
equipamentos_splitter_cor_cliente.equipamentos_splitter_id = 1)


Help - me ! Sql - codeigniter - El Forum - 08-23-2012

[eluser]ppwalks[/eluser]
Code:
$this->db->select('*');
$this->db->where_not_in('equipamentos_splitter_cor_cliente');
$this->db->where(' equipamentos_splitter_cor_cliente.equipamentos_splitter_cor_id','equipamentos_splitter_cor.id');
$this->db->where('equipamentos_splitter_cor_cliente.equipamentos_splitter_id', '1');
$query = $this->db->get('equipamentos_splitter_cor');

Something like that I think, its a bit rough to read though...


Help - me ! Sql - codeigniter - El Forum - 08-23-2012

[eluser]Junhinhow[/eluser]
the function "where not exists" of Mysql is the same as $this->db->where_not_in ???


Help - me ! Sql - codeigniter - El Forum - 08-23-2012

[eluser]ppwalks[/eluser]
Check this link out

http://ellislab.com/forums/viewthread/80477/#404387


Help - me ! Sql - codeigniter - El Forum - 08-23-2012

[eluser]Junhinhow[/eluser]
THANK YOU, HELPED ME ENOUGH