Using sql server 2008, I need a query to display the following results
User_Name Group_Name Checked
user1 Lead 0
user1 Admin 1
user1 Supervisor 0
user1 Monitor 0
user2 Lead 0
user2 Admin 0
user2 Supervisor 1
user2 Monitor 1
I have 4 groups (Lead, Admin, Supervisor, monitor) and the linking table is User Group. How do I get all groups displayed for each user (like above)? if group is checked for a user it appears in the User Group, not in the table if unchecked.
The tables:
User:
User_ID int
User_Name nvarchar
Email nvarchar
Group:
Group_ID int
Group_Name nvarchar
User Group:
User_ID int,
Group_ID int
try this: