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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 join 5 tables!

Author  Topic 

pamyral_279
Posting Yak Master

143 Posts

Posted - 2009-09-14 : 00:17:08
I have five tables(User,Usergroup,group,permission,permissiongroup)
User ---------->Usergroup <---------- Group
Permission----->Permissiongroup <---- Group

Users are in one or more groups.
Permsisions are in one more groups.
Now my task is show that all permissions of users !

User(Uid,username,password)
Usergroup(ugid,uid,gid)

Group(gid,groupname)

Permission(pid,permission)
PermissionGroup(pgid,pid,gid)


Any one help me ! thanks very much

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-09-14 : 01:13:12
Here is an example of a multi-table join, apply it to your situation:

SELECT t1.column1, t1.column2, t2.columnA, t3.someColumn
FROM Table1 t1
JOIN Table2 t2
ON t1.column1 = t2.column1
JOIN Table3 t3
ON t2.columnA = t3.ColumnA
...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

pamyral_279
Posting Yak Master

143 Posts

Posted - 2009-09-14 : 02:57:46
quote:
Originally posted by tkizer

Here is an example of a multi-table join, apply it to your situation:

SELECT t1.column1, t1.column2, t2.columnA, t3.someColumn
FROM Table1 t1
JOIN Table2 t2
ON t1.column1 = t2.column1
JOIN Table3 t3
ON t2.columnA = t3.ColumnA
...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."



Yeah ! Thank you very much.That's everything i want ... :)
Go to Top of Page
   

- Advertisement -