我有4個表,我想在codeigniter中一起加入表。 codeigniters加入方法可能嗎?在codeigniter中加入兩個以上的表
回答
如果您正在使用CodeIgniter的Active Record類,你可以只使用join
方法多次加入多個表。
$this->db->join('table2', 'table2.ID = table1.ID');
$this->db->join('table3', 'table3.ID = table1.ID');
$this->db->join('table4', 'table4.ID = table1.ID', 'left');
這是我期待的。讓我檢查一下 – 2011-04-28 03:23:46
我假設你正在談論加入SQL數據庫表,這是正確的嗎? 如果是這樣你可以隨時使用SQL笨的方法,請參見:http://codeigniter.com/user_guide/database/queries.html
在這裏使用CI的ActiveRecord連接方法也不存在問題。我猜他還沒有付出任何努力。 – 2011-04-21 11:21:00
我同意。閱讀友好的手冊:) http://codeigniter.com/user_guide/ – kraenhansen 2011-04-21 11:24:12
我試着用查詢方法。它的工作正常。但我想知道是否可以使用連接方法? – 2011-04-26 03:53:09
- 1. 在codeigniter中加入兩個表
- 2. 加入兩個以上的表格
- 3. Codeigniter通過UNION加入兩個表
- 4. CodeIgniter插入到兩個表
- 5. Hibernate加入問題,同時加入兩個以上的表
- 6. 在bigquery上加入兩個整個表
- 7. 列數上限我可以在MySQL中加入兩個表?
- 8. cakephp在一個連接表中一次加入兩個以上的表格
- 9. 加入兩個以上的表「不在」條款
- 10. 幫助SQL在兩個表上加入
- 11. 加入codeigniter查詢中的多個表
- 12. Unix加入兩個以上的文件
- 13. 在get_where codeigniter上加入表格
- 14. 加入3個表codeigniter php
- 15. 加入查詢中在codeigniter中加入兩個數據庫的方式
- 16. 我可以在共同列上加入兩個C#數據表
- 17. 如何在codeigniter中的兩個數據庫之間加入
- 18. 在查詢語言中加入兩個以上的WHERE語句
- 19. 將兩個不同的json加入codeigniter中的單個json
- 20. 加入兩個以上的表(強類型)
- 21. 在dql(Doctrine)中的兩個柱子的基礎上加入兩個表格
- 22. 加入兩個表
- 23. 加入兩個表
- 24. 以條件加入兩個表
- 25. 加入兩個colums到codeigniter中的一個柱子
- 26. codeigniter transact添加數據到兩個表
- 27. Codeigniter加入4表
- 28. 在codeigniter中一次更新兩個表
- 29. 在Python中加入兩個列表:
- 30. 在perl中加入兩個文件(表)
只需多次使用連接方法。它將加入每個表格。 – 2011-04-21 15:24:04
@火箭:請你舉個例子 – 2011-04-26 03:48:57
查看我的回答 – 2011-04-26 20:38:55