IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Display the emp of eath claims where the date < 10 YRs


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rambabu
Currently Banned

New User


Joined: 18 Apr 2005
Posts: 67

PostPosted: Sat Nov 18, 2006 3:59 pm
Reply with quote

I want to display the emp names of death claims where the date of death is within 10 years of the policy start date. Details:


crD-tnc,(Date of Death) column belongs r_deth table

Crd_PLCY_start ,(Policystart Date)column belongs r-plcy table
emp name belongs to r_edetails table
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Sat Nov 18, 2006 8:41 pm
Reply with quote

Hey Rambabu,

Please tell that how we relate r_edetails ,r_deth ,r-plcy table. means what 's the common column between these table.

Hope u understood what I m asking means the relationship between this table like the foreign key ...
Back to top
View user's profile Send private message
rambabu
Currently Banned

New User


Joined: 18 Apr 2005
Posts: 67

PostPosted: Sun Nov 19, 2006 6:14 pm
Reply with quote

claim id is cmmun field u will give the query
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Sun Nov 19, 2006 7:58 pm
Reply with quote

Hi there,


Code:
Select A.crD-tnc,
          B.Crd_PLCY_start
          C.emp_name

From r_deth A,r-plcy B,r_edetails C
where A.claim_id = B.claim_id
    and B.claim_id = C.claim_id
    and Year ( date(A.crD-tnc) - Date(B.Crd_PLCY_start ))<= 10;

Hope It will helpful
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Mon Nov 20, 2006 10:59 am
Reply with quote

Rambabu,

Try this... It'll compare differences of dates for exactly 10 years...
Code:
SELECT   A.CRD-TNC,
        B.CRD_PLCY_START,
        C.EMP_NAME
FROM    R_DEATH A,
   R_PLCY B,
   R_EDETAILS C
WHERE    B.CLM_ID = A.CLM_ID
    AND B.CLM_ID = C.CLM_ID
    AND A.CRD-TNC - B.CRD_PLCY_START <= 100000;


Note: Here "100000" correspond to 10 Yrs, 00 Months, 00 Days.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top