2 queries with left outer join will do the trick. select a.id,b.id from a left outer join b on a.id = b.id where b.id is NULL; this will give a list over all fields that exist in table a but not in table b
select a.id,b.id from b left outer join a on a.id = b.id where a.id is NULL; this will give a list over all fields that exist in table b but not in table a Hope this is useful for you. Terje K > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 08, 2002 9:32 AM > To: [EMAIL PROTECTED] > Subject: Fetching records from 2 tables > > > hi List > > The problem is like this > > There are two Tables A and B. > > what i want to do is find out all the records where a.id != b.id > > Both tables have close to 10000 records. so for every a.id it has to > check table b 10000 times and that is what is creating problems. > > bcos this query takes hell lot of time to execute and mysql stops > responding after some time. > > So is there some other way to find out records present in one table but > not in other. > > Thanks you can mail me at [EMAIL PROTECTED] also > > Pradeep > > > __________________________________________________________________________ > http://dating.zeenext.com Log on to nextDATE. It's the next > best thing to doing it. > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php