![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
works in MySQL: select a from table where 0 + a > 8 and 0 + a < 10 select a from table where cast(a as unsigned) > 8 and cast(a as unsigned) < 10 I think MySQL is doing the ANSI standard thing with the cast function. |
#3
| |||
| |||
|
|
Here is the problem. I have a character field that can contain numeric or string data, so it must be a character field. If I do a compare against the field directly, I get an alpha compare vs a numeric compare. So '10' is < '2', etc... For the numeric fields, I would like to do a ranged where clause. For instance: works in DB2: select a from table where integer(a) > 8 and integer(a) < 10 |
|
select a from table where cast(a as integer) > 8 and cast(a as integer) < 10 works in MySQL: select a from table where 0 + a > 8 and 0 + a < 10 |
|
select a from table where cast(a as unsigned) > 8 and cast(a as unsigned) < 10 I think MySQL is doing the ANSI standard thing with the cast function. |
![]() |
| Thread Tools | |
| Display Modes | |
| |