| 
 Posted by ashokinb on 08/21/06 08:53 
Hi, 
 
We have 2 tables as follows, 
 
TableA 
------------ 
doc_id ver_id ref_date 
 
TableB 
------------ 
doc_id ver_id ref_min_date 
 
We need to find out the records that exists in TableA but not in TableB 
and also to get the minimum of TableA.ref_date from the result. 
 
For example, 
 
TableA has the following rows 
doc_id              ver_id             ref_date 
100                   1                   10-AUG-2006 
100                   2                   12-AUG-2006 
100                   2                   13-AUG-2006 
100                   2                   14-AUG-2006 
100                   2                   15-AUG-2006 
200                   1                   17-AUG-2006 
300                   1                   18-AUG-2006 
 
TableB has the following rows 
doc_id              ver_id             ref_date 
100                   1                   10-AUG-2006 
200                   1                   10-AUG-2006 
 
Result should be as follows 
doc_id              ver_id             ref_date 
100                   2                   12-AUG-2006 
300                   1                   18-AUG-2006 
 
Please help us in writing the query 
 
Thanks 
Ashok
 
  
Navigation:
[Reply to this message] 
 |