CodeIgniter Forums

Full Version: Help - me ! Sql - codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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)

El Forum

[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...

El Forum

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

El Forum

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

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

El Forum

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