I'm trying to connect each answer in this table with the title to its question. I understand that nested queries are a bad idea. Is there another way to do this?
postid | type | parent_postid | title | content
----------------------------------------------------
1 | question | NULL | car wheels | how many
2 | answer | 1 | NUll | 4 wheels
SELECT * FROM table WHERE type = 'answer'
while($row = mysql_fetch_array($result)) {
$parent_postid = row['parent_postid'];
SELECT title FROM table WHERE postid = '$parent_postid'
}