Need help with select

  • Thread starter Thread starter TenTwenty via AccessMonster.com
  • Start date Start date
T

TenTwenty via AccessMonster.com

I have a table with the following data.


uidWeight MaxWeight Description

1 50 50Kg

2 60 60Kg

3 70 70Kg

4 80 80Kg

5 90 90Kg

6 100 100Kg

7 125 125Kg

8 130 130Kg+



When the user enter a weight of 131 or more I want to display the description of the maximum weight in the table, the same if the user enter a weight less than 50, then I want to display the minimum weight in the table. Any other weight and I want to display the description range of the weight => to the weight entered.


Anyone who can help me with the query?

Regards
 
TenTwenty said:
I have a table with the following data.

uidWeight MaxWeight Description

1 50 50Kg
2 60 60Kg
3 70 70Kg
4 80 80Kg
5 90 90Kg
6 100 100Kg
7 125 125Kg
8 130 130Kg+

When the user enter a weight of 131 or more I want to display the description of the maximum weight in the table, the same if the user enter a weight less than 50, then I want to display the minimum weight in the table. Any other weight and I want to display the description range of the weight => to the weight entered.


I'm not clear on what result you want, but have a play with
this kind of query:

SELECT TOP 1 Description
FROM table
WHERE enteredweight >= MaxWeight
ORDER BY MaxWeight DESC

If that is close to what you want, you'll need to add a
record to the table with a MaxWeight of 0 to catch the
wights less that 50.
 
Back
Top