Well, the following line does not join the penpals_privmsgs_block.user_id to anything:
penpals_privmsgs_block left join penpals_fav on penpals_privmsgs_block.user_id Anyhow, by LEFT JOINing the block table to the penpals_fav table you are saying you want one row for every row in the block table, with entries in the fav table when they can be linked, and NULL otherwise. I think you want the order of the tables reversed: penpals_fav LEFT JOIN penpals_privmsgs_block ON penpals_fav.user_id = pempals_privmsgs_block.user_id That way you get one row for each row in penpals_fav, with either the block information form the block table, or NULL. The try putting the AND penpals_privmsgs_block.blocked_id IS NULL line back in? Regards, Mike Hillyer www.vbmysql.com > -----Original Message----- > From: vernon [mailto:[EMAIL PROTECTED] > Sent: Monday, June 23, 2003 9:26 AM > To: [EMAIL PROTECTED] > Subject: RE: SQL query - 3 tables - 3rd one conatins records > to not display > > > OK so now I have something like this: > > SELECT distinct useronline.uname, penpals_fav.fav_user_id, > penpals_fav.ID, > penpals_privmsgs_block.user_id, penpals_privmsgs_block.blocked_id > > FROM useronline, penpals_privmsgs_block left join penpals_fav on > penpals_privmsgs_block.user_id > > WHERE penpals_fav.fav_user_name = useronline.uname AND > penpals_fav.user_id = > $colname AND penpals_privmsgs_block.blocked_id IS NULL > > > only this brings back nothing as when I remove the AND > penpals_privmsgs_block.blocked_id IS NULL statement it > results all the > people online, but the "penpals_privmsgs_block.blocked_id" > always equals 1 > (the value I'm looking for on the blocked user only)for every > record and > none are null, which is in fact not the case. > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: > http://lists.mysql.com/mysql?> [EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]