Ah, I see. Of course. And adding 0 is exactly what the manual says to do.
I was about to reply to say that |0 works where +0 does not when Bernard
sent his excellent suggestion to cast as unsigned. Then I spent a while
trying to figure out why you got such a large number for '40'. I
Why are you adding 0? Try this:
SELECT var1, var2 FROM test1;
Michael
Greg Vines wrote:
I'm trying to select all the fields from a set but when the number is
large, it is returned in exponential notation. Is there a way to keep
the returned number an integer?
Example:
create simple table:
With sets if you select the set, you get a comma delimited list, but if
you add zero, you get the number value of the entire set (which is what
I want). The response is not always in exponential notation - just when
a high order bit is set.
This seems to be a problem with the output
If you are using 4.0.2 and above you can use cast.
mysql select var1,cast(var2 as unsigned) from test1;
+--++
| var1 | cast(var2 as unsigned) |
+--++
|1 |562949953421312 |
|1 | 1 |
|1 |
Thanks Bernard - that fixed it!
On Fri, 2004-02-06 at 13:41, Bernard Clement wrote:
If you are using 4.0.2 and above you can use cast.
mysql select var1,cast(var2 as unsigned) from test1;
+--++
| var1 | cast(var2 as unsigned) |