View previous topic :: View next topic
|
Author |
Message |
rambabu Currently Banned New User
Joined: 18 Apr 2005 Posts: 67
|
|
|
|
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 |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
rambabu Currently Banned New User
Joined: 18 Apr 2005 Posts: 67
|
|
|
|
claim id is cmmun field u will give the query |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
|