I have SQL Server table structure like below:
ID Name ParentID ----------------------- 1 Root NULL 2 Business 1 3 Finance 1 4
This is a simple way:
SELECT ID,Name,(SELECT TOP 1 Name FROM Table t WHERE t.ParentID=ParentID) AS ParentName FROM Table