Keith,

Thanks for your comments.

KCI> It looks like the min and max are rounded to integers. Try
KCI> "SELECT 2 BETWEEN 2.1 AND 5" or "SELECT 3 BETWEEN 2 AND 2.8".

KCI> Also, the exponential numbers are converted to integers, not
KCI> truncated at the "e". It's just that your 1e30 is too big for an
KCI> integer. Try it with 1e18 instead. I don't know what 1e30 is
KCI> being converted to, though -- apparently not the max BIGINT.

Yes, good point. Sure enough, those integer examples get rounded (and
not truncated, either syntactically or numerically!) so all return
true, and as you expected, the 1e18 works.

My _recollection_ from the manual, and what I've seen happen, is that
oversized int's do indeed get converted to a MAXINT of some sort, and
what's odd is that is clearly not happening when 1e30 is squashed into
the integer type for the BETWEEN evaluation.

It's not yet obvious to me from the manual how to perform explicit
type-casts. I mean, I can do it on a case-by-case basis, so for
example in the problem I had earlier I worked around it by doing this
in my PHP code...

     "... WHERE ($myval + 0.0) BETWEEN min_field AND max_field;"

But, I don't see any obvious type-specification or casting that I
might use in a tidier, more general approach. Still reading though. I
tend to read the manual in patches around areas related to a given
question at any given time, so my knowledge is a bit uneven ;)


-- 
Best regards,
James.

[Filter fodder: SQL]


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

Reply via email to