by Lew <lew@[EMAIL PROTECTED]
>
Mar 28, 2008 at 10:23 PM
Roedy Green wrote:
> On Thu, 27 Mar 2008 22:00:32 -0700 (PDT), m <modhak@[EMAIL PROTECTED]
> wrote,
> quoted or indirectly quoted someone who said :
>
>> I write jdbc program which reads tables and compare row by row, just I
>> think it is laborious. Is there a better way of doing this. Please let
>> me know.
>
> do it in SQL with a where clause.. Presumably you want only that
> match or differ.
>
> This will probably be faster because no records have to be trans****ted
> to your application which may be running on a different box.
Given tables A and B that share a primary key (PK):
CREATE TABLE A ( id INTEGER PRIMARY KEY, etc. )
CREATE TABLE B ( id INTEGER PRIMARY KEY, etc. )
SELECT COUNT(*) FROM A WHERE id NOT IN (SELECT id FROM B);
and vice versa.
--
Lew