After more than 2 years, I think that this can be usefull...
My table categories have the parents ids of the roots categories with the value NULL
Two solutions:
#1. Don't show the parent's name of the roots (NULL !):
SELECT c.category_id, c.category AS 'Name', c1.category AS 'Parent Name'
FROM categories AS c, categories AS c1
WHERE c.parent_category_id = c1.category_id
;
#2. Show the parent's name of the roots, for those that love subqueries...
SELECT c.category_id AS catId, c.category AS 'Name',
(SELECT category
FROM categories
WHERE category_id = c.parent_category_id
) AS 'Parent Name'
FROM categories AS c
;