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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with <= request

Status
Not open for further replies.

ElBlues

Programmer
Jul 1, 2004
13
0
0
GB
Hi

I have a query that reads
WHERE Rent <= 'varMax'

Where varMax is a number entered by the user and Rent is the number in the database, when the user puts in a number with three figures, even though the database cointains an entry of 40, it returns no results, any idea why???
 
Have you tried this ?
WHERE Rent <= varMax

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Sorry, the full query is:

SELECT * FROM ROOMS WHERE City LIKE '%varCity%' AND Rent <= 'varMax'

taking away the inverted commas didnt help...
 
Which DBMS ?
Anyway, don't use single quotes when you test numeric fields.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PH, thanks for the advice, have it working now!
Hadnt made the column numeric! Doh! Taking off the inverted commas helped too, many thanks!!
 
It's not returning results because it thinks Rent isn't less than 'varMax' for whatever reason. What type of fields are Rent and 'varMax'? Maybe there's a 'type' problem. Can you see what varMax is actually returning?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top