使用简单关系一对多 RedBean 和 CodeIgniter
在我的新项目中,我决定将 RedBean ORM 系统与 CodeIgniter PHP 框架。
如何从具有简单关系的表中获取所有记录?我知道我可以使用 R::exec
或 R::getAll
查询,但我想确定是否还有其他解决方案。
表结构:
语言
- id
- title
categories
- id
- language_id
- title
表categorieslanguage_id
code> 与表 languages
中的 id
字段相关。
我的目标:
SELECT l.title, c.*
FROM categories AS c
LEFT JOIN languages AS l
ON (c.language_id = l.id)
有什么解决方案吗?
In my new project, I decided that I will use the RedBean ORM system with CodeIgniter PHP Framework.
How can I get all records from a table with a simple relation? I know that I can use R::exec
or R::getAll
queries, but I want to make sure if there any other solution(s).
TABLE STRUCTURE:
languages
- id
- title
categories
- id
- language_id
- title
The field language_id
in the table categories
is related with the id
field in the table languages
.
MY GOAL:
SELECT l.title, c.*
FROM categories AS c
LEFT JOIN languages AS l
ON (c.language_id = l.id)
Any solutions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)