How to get the parent child relation in same table In Sql Server
SELECT
ChildUserType.Id as CategoryId,ChildUserType.Category as CategoryName,
ChildUserType.IsActive,ChildUserType.CategoryURL as CategoryURL,
ChildUserType.CreatedOn,ChildUserType.ParentId,
ParentUserType.Category as ChildParentname,ChildUserType.NoofOrgs
FROM
[dbo].[Categories] AS ChildUserType
LEFT JOIN
[dbo].[Categories] AS ParentUserType
ON
ChildUserType.ParentId = ParentUserType.Id
Comments
Post a Comment