I have a schema that essentially looks like this:
CREATE TABLE `data` ( `id` int(10) unsigned NOT NULL, `title` text, `type` tinyint(4), `parent` int
SELECT * FROM `data` ORDER BY COALESCE(`parent`, `id`), `parent`, `id`