title: Mysql 1:n JOIN SELECT query
body: <p>I have a web application where users can make posts and other users can make comments. I am using a mysql database to hold my data. Currently I have two tables. One has all posts and one has all comments. I have the foreign key <code>postID</code> on my comments table. My question now is how I can get the data from the database back to my app. I have tried the following query but it does not work. I will explain why in a minute. Here is the query I tried:  <code>SELECT posts.title, posts.body, comments.userID, comments.comment FROM posts INNER JOIN comments ON posts.postID = comments.postID WHERE posts.postID = comingfromwebapp</code>. The problem is IF there are zero comments nothing comes in. And If there are multiple comments and the post is too big, the result from the query is too big because in every row I receive the same posts.body for every comment. What is the correct way to implement this? I am rather new to SQL databases and have only used NOSQL before.</p>