i have 3 columns in table, there are:
id, name, parentdepartment
the value of parentdepartment id column id. example :
id : 1,2,3 name : finance, product , services, support parentdepartment : 1, 2, 2 it means id 1 has parent department 'finance', id 2 & 3 has parent department 'product , services'.
my question how show department name based on parentdepartment in webgrid column? result be:
id : 1, 2, 3 name : finance, product , services, support parentdepartment : finance, product , services, product , services please help.
you can use inner join such results.
select t1.id, t1.name name, t2.name parentdepartment mytable t1 inner join mytable t2 on t1.parentdepartment = t2.id however, strange finance department's parent department finance department.
here sql fiddle snippet.
Comments
Post a Comment