select question.postid as questionID, question.title as questionTitle, question.content as questionContent, answer.content as answerContent from table question inner join table answer on( question.postid=answer.parent_postid ) order by question.postid
Note that you must use the alias of the columns, since they will have the same name, and you cannot distinguish it by the name of the column.
You also want to use orderby so you can group all the answers together with the corresponding question. You can scroll and start processing a new question each time the questionID changes.
source share