Google for "SELF JOIN" You also may want to just put the parent_id in the category table, rather than a second table. Your query would then look like this: select parent.tid, child.tid from term_data as parent, term_data as child where child.parent_id = parent.tid and child.vid = 16 order by weight, name WARNING: If term_data is a LARGE table, this query could become problematic. You'll need an index on (tid, vid, weight, name), I think. Follow-up with more questions to the MySQL (or other SQL) mailing list please, as there's no actual PHP in this question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php