【发布时间】:2016-02-24 18:37:35
【问题描述】:
我有这样的表
tbl_post
+-----------+--------------+
| post_id | post_content |
+-----------+--------------+
| 1 | contentone |
+-----------+--------------+
tbl_category
+-------------+---------------+
| category_id | category_name |
+-------------+---------------+
| 1 | Politic |
| 2 | Social |
| 3 | Economy |
+-------------+---------------+
tbl_category_post
+------------------+-------------+---------+
| category_post_id | category_id | post_id |
+------------------+-------------+---------+
| 1 | 1 | 1 |
| 2 | 2 | 1 |
| 3 | 3 | 1 |
+------------------+-------------+---------+
那么我想要这样的输出
+--------------+--------------------------+
| post_content | category |
+--------------+--------------------------+
| 1 | Politic, Social, Economy |
+--------------+--------------------------+
然后如何使用codeigniter显示这样的数据,我真的很困惑,请任何人帮助我!
【问题讨论】:
-
使用数据库“内连接”语句。 stackoverflow.com/questions/16013364/…
标签: php mysql codeigniter