tags:

views:

22

answers:

1
+2  A: 

Don't use a join in this case as it does not give any advantage and instead it will slow down the queries. Rather do two separate queries:

mysql_query('SELECT *
         FROM threads AS t
         WHERE t.t_id = '.mysql_escape_strings($_GET['t_id']));

And:

mysql_query('SELECT *
         FROM replies AS r
         WHERE r.t_id = '.mysql_escape_strings($_GET['t_id']));

This will be much faster.

shamittomar
The join gives you exactly the same information as the two-query approach, but because it duplicates the thread table's columns for each reply, it will produce a larger amount of (redundant) data. +1.
tdammers
Got it, thanks.
hey