On 8 Dec 2003 at 11:30, Ed Curtis wrote:

> I've got an entry in a table where the value is 875. If I run a query
> on that table with the clause AND sqaurefeet >= '$squarefeet' and
> $squarefeet has a value of say 1000 the row with the squarefeer value
> of 875 will appear. The column is of type varchar(10) and using the
> binary flag.

If the column is VARCHAR, then the comparison is correct.  The string 
'875' is greater lexically (alphabetically) than the string '1000'.  
If you want the comparison to be numeric, you should use an integer 
(or other numeric type) for the column.  Failing that, you have to 
cast the value into a numeric type before comparing them.

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to