SQL select statement from 2 tables
- by Steven
Hi, I have a small sql question.
I have 2 tables
Members and Managers
Members has: memberID, Name, Address
Managers has: memberID, EditRights, DeleteRights
EditRights and DeleteRights are of type bit.
Mangers have a relationship with Members, because they are members themselves.
I want to select all members id's, name and adress and for the members that are managers show if they have editrights and/or deleterights.
SO:
Exmaple data
Members:
ID, Name, Address
1, tom, 2 flat
2, dan, 3 flat
3, ben, 4 flat
4, bob, 6 flat
5, sam, 9 flat
Managers:
ID, Editrights, deleterights
2, 0, 1
4, 1, 1
5, 0, 0
I would like to display a select like this:
1, tom, 2 flat, no rights
2, dan, 3 flat, Delete
3, ben, 4 flat, no rights
4, bob, 6 flat, Edit&Delete
5, sam, 9 flat, no rights
Any help would be great