我正试图获得(例如)帖子的评论。 我有两张桌子,帖子和评论。注释表具有属于该帖子的外键。
是否可以使一个查询获得这样的数组?
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
)
)
)
显然,如果结果是数组或对象数组,则无关紧要
谢谢!