Hi All,
I am developing a User Management application, Where I have multiple role of single user. On a List page I need to show all Roles name which assigned to user. But with aggregate I am not able to do it.
I am trying to sql but not able to solve it.
Can anyone help me on that.
Thanks in advance.
Hi @Mark Joe ,
You can use below sql -
Select UM.[Id],UM.[Name],
(
select ','+RM.[Name]
from {Role} as RM
INNER JOIN {User_Role} on RM.[Id] = {User_Role}.[Role_Id]
for xml path('')) as RoleName
from {User} as UM
And this is the output structure.
In Addition you can added more attributes and filter condition in this sql.
Hope this will help you.
Thanks its work as expected.