【发布时间】:2013-10-07 09:25:50
【问题描述】:
如何获取不在 table_2 中的 table_1 id
我的桌子看起来像这种类型。
table_1
---------------------------------------------
| id | user |
---------------------------------------------
| 1 | Jack |
---------------------------------------------
| 2 | John |
---------------------------------------------
table_2
------------------------------------------
| web_id | website |
------------------------------------------
| 2 | Facebook |
------------------------------------------
| 3 | Google+ |
------------------------------------------
我想codeigniter查询
$this->db->select("*");
$this->db->from("table_1");
$this->db->where_not_in('id', "table_2.web_id");
return $this->db->get();
【问题讨论】:
-
这两张表有什么关系?
-
我认为 id 和 web_id
-
我在下面添加了两种方式的查询
标签: php sql codeigniter