Try with Left outer join
on the table itself (so we do not lose any rows if INNER JOIN
is used and no ParentCategoryID
is specified):
SELECT R.productID,
C.ParentCategoryID,
C.categoryName,
ISNULL(C1.CategoryName, '') as ParentCategoryName
FROM Category C
INNER JOIN ref_Product_Category R
ON C.categoryID = R.categoryID
LEFT OUTER JOIN Category C1 on Category.ParentCategoryID = C1.CategoryID