From: Martijn Tonies Date: February 6 2004 10:18pm Subject: Re: A challenge I think List-Archive: http://lists.mysql.com/mysql/159167 Message-Id: <001c01c3ecff$16c80a10$0e02a8c0@martijn> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, > Using MySQL 4x > I have two tables > Lists and members > Now for every list that a member is a member of there is list ID in the > members table so to query a members lists I would do the following > SELECT members.EmailAddr, members.ListID > > FROM members INNER JOIN lists ON members.ListID = lists.ListID > WHERE (((members.EmailAddr)="john_berman@stripped")); Loose the parenthesis - no need. > So I get say > John_berman@blueyonder 3 > John_berman@blueyonder 2 > John_berman@blueyonder 44 > > And it works fine, but now I want to find which lists I'm not a member of > and would appreciate some help. select l.listid from lists l where l.listid not in (select m.listid from members m where m.emailaddr = 'john_berman@stripped') With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL Server. Upscene Productions http://www.upscene.com