I don’t know if you got what I mean, but I’ll try to explain it with an example.
Users Table
UsedId UserName
-------- ----------
1 Mike
2 Raul
HasPrivileges Table
UsedId PrivilegeId
-------- --------------
1 1
1 2
1 3
2 2
2 3
Privileges Table
PrivilegeId Privilege
------------- ------------
1 Create
2 Edit
3 Delete
now this is two tables users and privileges that has a many-to-many relation between them, so when I select all the users associated with the privileges they have, I get the in this examples 3 records or rows in result for Mike each one contains a privilege he has.
Now I need in my application to display a list of all the users with their privileges but INDEED i don’t want my users to see a user three times to show all of his privileges or anything else instead I want it to display
User Id : 1
Name : Mike
Privileges : Create, Edit, Delete
or something close to this! ANY IDEAS GUYS !??
You have ASP.NET and C# in your tags. Considering that what you intend to do is a presentational issue, do it in the presentation layer (i.e. with C#) and not in the data layer (i.e. with SQL). That’s a lot easier, too.
For example, like shown here: Use LINQ to concatenate multiple rows into single row (CSV property)