Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
IanMJ
Starting Member
3 Posts |
Posted - 2001-01-15 : 07:45:05
|
| Hi,I'm trying to build a permissions based system using ASP & SQLServer.I have two tables, a users/groups table and a parent/child join table.Example:tblUsersGroupsId 1 Name = Parent Company AId 2 Name = Subsidiary Company BId 3 Name = Subsidiary Company CId 4 Name = User AId 5 Name = User BId 6 Name = User CtblParentChild relationshipsParent id 1 Child id 2Parent id 1 Child id 3Parent id 1 Child id 4Parent id 2 Child id 5Parent id 3 Child id 6This makes 'User A' a member of the 'Parent Company A', 'User B' a member of 'Subsidiary Company B' and 'User C' is a member of 'Subsidiary Company C'.What I'm trying to do with SQL is get my user's id, find out what group they belong to and show them products from that group and groups that are below them in the chain, so if you are a member of 'Parent Company A' you can see everything from Parent Company A, Subsidiary Company B, Subsidiary Company C. If you are only a member of Subsidiary Company B you can only see Subsidiary Company B's products. You could then go on to define Subsidiary Company B has Team A and B etc.Would I need to go through a loop to achieve this?Thanks,Ian |
|
|
|
|
|