Hi Andy thanks for the quick reply. Thsi solution seesm to list all the record from table 1 that DO have a coressponding record in table 2... not the ones that DONT. :( thanks again Moshe
-----Original Message----- From: Mills, Andy R. (Regency) [mailto:[EMAIL PROTECTED] Sent: Friday, March 18, 2005 3:17 PM To: '[email protected]' Subject: RE: [ASP] SQL question Moshe: I believe you want to use a LEFT JOIN. SELECT field1, field2, field3 FROM first_table LEFT JOIN second_table ON first_table.keyfield = second_table.foreign_keyfield HTH Andy -----Original Message----- From: Moshe Tapnack [mailto:[EMAIL PROTECTED] Sent: Friday, March 18, 2005 8:15 AM To: [email protected] Subject: [ASP] SQL question Hi i have a table with 2 DBs. obviously one field links from the one to the ID of the second. I would like to run a query - which records from table 1 have an value in that field, but the corresponding ID in table 2 doesnt exist. ( and then if it doesnt exist... then reset that field to zero.). i know how to do this with 2 queries.... but that isnt very efficient, and it also would take ages, cos i have 2000 records to check. is there a quicker way to do this? Thanks in advance! Moshe [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Sponsor ADVERTISEMENT <http://us.ard.yahoo.com/SIG=129oqb00k/M=298184.6191685.7192823.3001176/D=gr oups/S=1705115381:HM/EXP=1111238276/A=2593423/R=0/SIG=11el9gslf/*http://www. netflix.com/Default?mqso=60190075> click here <http://us.adserver.yahoo.com/l?M=298184.6191685.7192823.3001176/D=groups/S= :HM/A=2593423/rand=924599996> _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . [Non-text portions of this message have been removed] --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
