View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 11:29 AM
FFMG
 
Posts: n/a
Default Help with 3 tables select


Hi,

I have a table of users

TABLE_A = username, userID

They are member of one _or more_ group

TABLE_B = userID, grouID

Each group has a set of one _or more_ permissions

TABLE_C = grouID, permission

So to get the permissions for one user I could do 3 queries.

SELECT userID FROM TABLE_A where username = 'x'
SELECT groupID FROM TABLE_B where userID = TABLE_A.userID
SELECT permission FROM TABLE_C where groupID = TABLE_B.groupID

How could I do the above in one simple query?

The table are really that simple, but I want to keep them separated
because each groupID will have a name and each permissionID will also
have a name.

How would you simplify those 3 queries?

Thanks
FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=21905

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

Reply With Quote