我正在尝试获取(例如)帖子的评论。我有两个表,发布和评论。评论表有一个属于帖子的外键。
是否可以进行一次查询以获得这样的数组?
Array
(
[0] => stdClass Object
(
[id] => 1
[title] => post title
[content] => post content
[comment] =>
[0] => stdClass Object
(
[id] => 105
[content] => This is a comment
)
[1] => stdClass Object
(
[id] => 199
[content] => This is other comment
)
)
)
显然,如果结果是数组数组或对象数组,没关系
谢谢!