Use a Count From Another Query to Determine 'n' in Top 'n'

mstorer

Registered User.
Local time
Today, 00:40
Joined
Nov 30, 2001
Messages
95
Our insurance policies use a driver rating factor which is used to determine premium. This factor is derived from driving experience, accidents , etc. of each driver listed on the policy. On policies with multiple vehicles, we take the average of the factors for each driver. For policies where the number of drivers exceed the number of vehicles, we take the highest rated drivers equal to the number of vehicles.

For example, for a policy with 10 drivers and 6 vehicles, we calculate the average of the 6 highest rated drivers.

I have one query which counts the number of vehicles from our vehicles table. I want to use that value in my SELECT TOP n statement the the drivers. Is there any way to accomplish this?

Thanks for any insight.

- Matt
 

Users who are viewing this thread

Back
Top Bottom