Is there a way to specify the parent query field from within a subquery in mySQL?
For Example: I have written a basic Bulletin Board type progra
Give the tables unique names:
$query = "SELECT a.id, (SELECT COUNT(1) FROM post_table b WHERE parent_id = a.id) as num_children FROM post_table a WHERE a.parent_id = 0";