Could you please suggest me how this can be handled.
I have two DB2 tables , table A and table B. both has reg.no in it.
I need to find the reg.no found in table B which is not available in table A. I used the query,
select distinct reg_no from B b
where b.reg_no not in (select a.reg_no from A a)
I dint get proper output. most of reg.no are not coming in the output.
Could anybody suggest me a solution.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
Hello,
Are you willing to write some code to do this?
Rather than one problematic query (that you have), you could use 2 queries. The first to read the B entries (distinct) and then read the A table using the reg_no. Either it is found or not and the code would act accordingly.
Another was would to be to create sequetial files of the entries in both tables and compare these with your sort product.
With the query you have, you might consider GROUP BY instead of distinct.
Quote:
I dint get proper output. most of reg.no are not coming in the output.
Saying it didn't work gives nothing to use to help you. Sayin "most are not coming" provides little. You need to post which ones are failing and determine why they fail.