On Fri, 16 Aug 2002, Oded Arbel wrote: > Shlomi Fish wrote: > > >I have three tables: clubs, users and permissions. clubs contains a > >Club_ID (an integer). users contains a User_ID. Permissions contains both > >as well as a Subjects field (a boolean). > > > >Now, a user is allowed to edit the data associated with a club if he has a > >record in the permissions table (with the appropriate User_ID and > >Club_ID). He is allowed to edit the subjects if the Subjects field is set. > > > >Now, I want to make one query that given a User_ID will return a list of > >all the clubs in clubs with the following three fields: > > > >1. Club_ID > >2. Whether a record exist in Permissions. > >3. If so, whether the Subjects flag is set (or if 2 is false - > >undetermined) > > > >I am using MySQL 3.23.47, but can possibly switch to PostgreSQL. > > > > > You need to do a left outer join on the clubs and permissions table, something which >MySQL 3 does not support. 4.1 should do it, but I have only 4.0 installed and I can't >make it it the query Arik came up with. I don't know if PostgreSQL can do it. > > Credits: Arik Baratz, our resident SQL guru came up with the correct query. if >you're still interested I can send it. >
Hi, please send it to me. Regards, Shlomi Fish > -- > Oded > > ::.. > Friends should be like throw pillows; > Comfortable to lean on, and unmindful of the weight. > --Ginger Eastham > > ---------------------------------------------------------------------- Shlomi Fish [EMAIL PROTECTED] Home Page: http://t2.technion.ac.il/~shlomif/ Home E-mail: [EMAIL PROTECTED] "Let's suppose you have a table with 2^n cups..." "Wait a second - is n a natural number?" ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]