Lookup Value in a Range

G

Guest

In one table I have a listing of employees and the number of hours that they
have worked for the company. In another table I have a list of ranges 250,
500, 750, ... with corresponding levels for each. So for example In Table 1 I
have John who has worked 721 Hours. That is greater than 500 but lsee than
750 so i want to return the level associated with 500 (level 2 in this case).
How do I do that.

1 250
2 500
3 750
4 1500
 
G

Guest

I recommend addin another field to have Level, Low, and High. Then use
Between function. See the tables and query below ---
[RateTable-Mileage]
MinMiles MaxMiles Rate
0 500 0.2075
501 1500 0.1582
1501 999999 0.1521
[Travel]
Name Mileage
joe 650
dd 100
ll 10000
p 10

SELECT Travel.Name, Travel.Mileage, [RateTable-Mileage].Rate
FROM Travel, [RateTable-Mileage]
WHERE (((Travel.Mileage) Between [MinMiles] And [MaxMiles]));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top