I'm trying to code a query that gets all the news and all the comments for each news. My current query is :
SELECT n.*,
       c.* AS comments
  FROM news n
       JOIN comments c ON (c.news_id = n.id)
Ben bir dizi olarak sorgu getir zaman ama bana Yorumlarınız tarafından bir anahtar verir ve ben bir alt-dizide haberlerden bir anahtarı ve tüm yorumlarınız istiyorum.
Gibi bir şey:
Array
(
    [0] => Array
    (
        [id] => 1 // news' id
        ...       // rest of news' data
        [comments] = Array
        (
            [id] => 1 // comment's id
            ...       // rest of comments' data
        )
    ),
    ... // all other news
)
Teşekkürler!
 
			