Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 3 of 3 total |
Compare records in 2 tables |
Fri, Nov 28 2008 4:31 AM | Permanent Link |
Pat | Hi all,
I have two v4 tables (one field in each). I want to find the records that are in one table and not the other. Say Table A: Apple Orange Pear Table B: Apple Banana Pear Grape The required output would be Orange Banana Grape The long to do it would be to iterate through Table A and find which record is not found in Table B, then do the same with Table B. Is there something like a 2 line SQL that will do this? Thanks. Pat |
Fri, Nov 28 2008 5:57 AM | Permanent Link |
"John Hay" | Pat
> I have two v4 tables (one field in each). I want to find the records > that are in one table and not the other. Say > > Table A: > Apple > Orange > Pear > > Table B: > Apple > Banana > Pear > Grape > > The required output would be > Orange > Banana > Grape How about SELECT fieldname FROM TableA WHERE fieldname NOT IN (SELECT fieldname FROM TableB) UNION SELECT fieldname FROM TableB WHERE fieldname NOT IN (SELECT fieldname FROM TableA) John |
Fri, Nov 28 2008 6:48 PM | Permanent Link |
Pat | Hi John,
>> The long to do it would be to iterate through Table A and find which >> record is not found in Table B, then do the same with Table B. Is >> there something like a 2 line SQL that will do this? >How about > >SELECT fieldname FROM TableA WHERE fieldname NOT IN (SELECT fieldname FROM >TableB) >UNION >SELECT fieldname FROM TableB WHERE fieldname NOT IN (SELECT fieldname FROM >TableA) it works great thanks very much Pat |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |