php - how to get value which not in table 2 -
how table_1 id not in table_2
table type.
table_1
--------------------------------------------- | id | user | --------------------------------------------- | 1 | jack | --------------------------------------------- | 2 | john | ---------------------------------------------
table_2
------------------------------------------ | web_id | website | ------------------------------------------ | 2 | facebook | ------------------------------------------ | 3 | google+ | ------------------------------------------
i want codeigniter query
$this->db->select("*"); $this->db->from("table_1"); $this->db->where_not_in('id', "table_2.web_id"); return $this->db->get();
try
select id table_1 id not in ( select web_id table_2 1 );
using codeigniter active records query follows
$this->db->select('*'); $this->db->where('id not in (select web_id table_2 1)', null, false); $query = $this->db->get('table_1');
Comments
Post a Comment