I think this is the best place for this question, though it may require some PHP knowledge as well. The question: Is there a way to modify the SELECT statement to do this without modifying the PHP code? If not, what's the best way to do what I want? The table: CREATE TABLE IF NOT EXISTS `alol_wplinkdir_cats` ( `id` int(11) NOT NULL auto_increment, `title` varchar(250) NOT NULL, `parent` varchar(250) NOT NULL, `description` varchar(250) NOT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; INSERT INTO `alol_wplinkdir_cats` (`id`, `title`, `parent`, `description`) VALUES (1, 'Blogs & Blogging', '', 'All about the fine art of writing nonsense.'), (2, 'Games', '', 'Video gaming, online games and more.'), (3, 'WordPress Sites', 'Blogs & Blogging', 'all the wordpress sites ya know'), (4, 'Blogger Stuff', 'Blogs & Blogging', 'lots of shit in this cat'), (6, 'Video Games', 'Games', 'computers n consoles n shit'), (7, 'Board Games', 'Games', 'lol board gamez dnd n that'); The PHP code: $getCats=mysql_query("SELECT * FROM $cat_table ORDER BY title ASC"); while($Cat=mysql_fetch_assoc($getCats)){ $Cats[$Cat['title']]=($Cat['parent'] == '' ? 'parent' : $Cat['title']); } echo '<tr><td>Category:</td><td><select name="category">'; foreach($Cats as $Title => $Value){ echo '<option'.($Link['category'] == $Title ? ' SELECTED' : '').'>'.($Value == 'parent' ? '' : ' - ').$Title.'</option>'; } echo '</select></td></tr>'; This displays a list of categories like: - Blogger Blogs Blogs & Blogging - Board Games Games - Video Games - WordPress Sites When what I want is: Blogs & Blogging - Blogger Blogs - WordPress Sites Games - Board Games - Video Games In which the Categories which don't have parent categories are displayed in alphabetical order, under which their sub categories are also displayed alphabetically.