I have the below query which works as I need it, but I also want to add the name of the ParentCategoryID in another column which would need to custom as there is no column for ParentCategory name. The only way I can get that is by referencing the CategoryID that I retrieved from t.ParenCategoryID. CategoryID and ParentCategoryID are in the same table. Can this be accomplished a sub query?
SELECT c.ContentID
,c.Title
,t.CategoryID
,t.Name
,t.ParentCategoryID
FROM Content c
INNER JOIN ContentCategory g ON c.ContentID = g.ContentID
RIGHT JOIN Category t ON g.CategoryID = t.CategoryID
ORDER BY g.CategoryID
Thanks in advance.