database,sql,query
>Paul DuBois writes:
>> At 6:03 PM -0300 5/24/01, Adriano Nagelschmidt Rodrigues wrote:
>> >
>> >level ENUM('bad', 'good', 'great') NOT NULL
>
>[snip]
>
>> >SELECT * FROM foo WHERE level >= 'good'
>
>[snip]
>
>> >Shouldn't a numeric context be applied by the server in this case? eg,
>>
>> Why? 'good' isn't a number, and it's perfectly legal to compare strings
>> with the >= operator.
>
>Because you can (actually, you do) define whatever order you want in
>the ENUM declaration (even alphanum order).
True, and although that's used for sorting, not so for comparisons it seems.
>
>The way it works now, I have to know in which position the label
>'good' is to construct the select. I think this leads to unnecessary
>duplication (is there a function that returns the position of a label?
>I couldn't find it in the manual).
Try this:
SELECT level + 0 from foo where level = 'good' LIMIT 1;
>
>IMHO, if it were abstracted away by the server we would have better
>functionality.
>
>Regards,
>
>--
>Adriano
--
Paul DuBois, [EMAIL PROTECTED]
--
Paul DuBois, [EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php