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

Popular posts from this blog

How to get the user details, user current level, next level, Rank in sql server

How to update the user level when ever user report any tweet in sql

Implement virtualisation in kendo drop down list using jquery ajax in mvc, aspx page