linq select m:n user:groups

Posted by cduke on Stack Overflow See other posts from Stack Overflow or by cduke
Published on 2010-05-30T07:05:49Z Indexed on 2010/05/30 7:12 UTC
Read the original article Hit count: 669

Filed under:
|

Hi guys,

I've got three tables:

cp_user (id, name)
cp_group (id, name)
cp_usergroup (user_id, group_id)
  • the classical m:n stuff.

Assume the following Data:

cp_user
1, Paul
2, Steven

cp_group
1, Admin
2, Editor

cp_usergroup
1, 1
1, 2
2, 2

So Paul is in the Admin AND Editor group, while Steven is just in the Editor group. I want to generate a list like that from the database:

Paul Admin
Paul Editor
Steven Editor

Any suggestions?

Thanks! Clemens

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-entities