If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Find missing records in two tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-07-07, 11:34
samu78nyc samu78nyc is offline
Registered User
 
Join Date: Nov 2006
Posts: 31
Find missing records in two tables

Hi all,
I have two similar tables CUST and CUST_TEMP, and they are both supposed to have the same data and when I am looking at the counts CUST_TEMP if off by 100+ records.
The primary key is CUST_ID (INT (4)) and ASSET ( CHAR(80)) .
Is there a way to find the missing records in CUST_TEMP table?

Thanks in advance..
Reply With Quote
  #2 (permalink)  
Old 06-07-07, 12:25
guyprzytula guyprzytula is offline
Registered User
 
Join Date: Jun 2006
Posts: 471
select * from cust a where not exists
(select t.CUST_ID ,t.ASSET
from cust_temp t
where
t.CUST_ID=a.cust_id and
t.ASSET =a.asset)
__________________
Best Regards, Guy Przytula
DB2 UDB LUW certified V6/7/8
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On