【发布时间】:2014-03-04 04:16:41
【问题描述】:
我正在尝试使用 CodeIgniter 中的 Active Record 复制以下查询,但我找不到文档中的位置或搜索您如何在查询中使用 USING。
SELECT *
FROM categories C
LEFT OUTER JOIN motorcycle_brands MB
USING ( CatID )
LEFT OUTER JOIN powersport_categories PS
USING ( CatID )
WHERE C.CatID = :uniqueID
这就是我现在拥有的:
$this->db->select('*');
$this->db->from('categories C');
$this->db->join('motorcycle_brands MB', 'CatID', 'left outer');
$this->db->join('powersport_categories PS', 'CatID', 'left outer');
$this->db->where('C.CatID =', $this->option_id);
$suboptions = $this->db->get();
我尝试过改变
$this->db->join('motorcycle_brands MB', 'USING (CatID)', 'left outer');
$this->db->join('powersport_categories PS', 'USING (CatID)', 'left outer');
【问题讨论】:
-
您的代码是否有任何错误,您在下面提到
This is what I have now:?
标签: php mysql codeigniter