Subject Re: [firebird-support] Help with strange answer in WHERE clause
Author Ann W. Harrison
At 05:03 PM 5/3/2004, hcarvajalsy wrote:
>Hello,
>I am having a strange behaviour in a SELECT statement. The field
>over which I do the WHERE is defined as VARCHAR(5). If I do:
>SELECT COUNT(*) FROM STUDENTS WHERE SCHOOL <= '999';
>
>I get 10,569 as the answer, but if I do:
>SELECT COUNT(*) FROM STUDENTS WHERE SCHOOL <= '1000';
>
>I get 0 as the answer.

If you define the field as varchar, comparisons are done as if the values
were strings. The string '1000' sorts lower than the string '999'. If you
want numeric comparisons, you should define the field to be numeric.


Regards,


Ann