Need help with select

TenTwenty

New member
Local time
Today, 15:21
Joined
Dec 20, 2004
Messages
5
I have a table with the following data.


Code:
[U][B]uidWeight     MaxWeight     Description[/B][/U]

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
 
MaxWeight Query

TenTwenty said:
Code:
[U][B]uidWeight     MaxWeight     Description[/B][/U]

1            50     50Kg 
2            60     60Kg
3            70     70Kg
4            80     80Kg
5            90     90Kg
6            100    100Kg
7            125    125Kg
8            130    130Kg+
I think I'd change the structure of the table slightly to make the query easier but it's a multi-stage process.
  • Add another column, MinWeight
  • Copy MaxWeight into MinWeight
  • Increment MaxWeight by 9
  • Edit Row 1 MinWeight to be 0
  • Edit Row 8 MaxWeight to be 999999
Now you can write a query with a Where clause like [User Unput] > MinWeight and [User Unput] < MaxWeight.
Feel free to polish this but hopefully it's a starter.
 

Users who are viewing this thread

Back
Top Bottom