Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to skip certain years

Status
Not open for further replies.

circles

Technical User
Feb 12, 2001
26
US
Here is sample table I have built

Policy Year Losses Losses Pd Premium
1234 99 1 $3,000 $2,000
1234 00 0 $0000 $3,000
1234 01 2 $5,000 $4,000

I am trying to build a query that will only total the paid losses and premium in the years that this policyholder had claims then in the end have a totals section for the policy holder that will read that they had 3 claims $8,000 in pd losses and a premium of $6,000. Any suggestions are appreciated.
 
Just write an aggregate query that groups by policy and sums losses paid and sums premium WHERE losses paid > 0.

This should return rows that look like this:
Policy Sum(Losses Pd) Sum(Premium)
1234 $8000 $6000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top