Yes that must be it. Both columns are unsigned. Is
there any way to accomplish this with one query with
unsigned columns?

Otherwise I will have to fetch each column seperately
(two queries) and then do the subtraction outside
MySQL (in my C code).


 --- Victoria Reznichenko
<[EMAIL PROTECTED]> wrote: > On Tuesday
04 March 2003 16:51, Jamie Jennings
> wrote:
> 
> > Hi. I've got two mediumint columns in a mysql
> table,
> > and I'm trying to subtract them like this:
> >
> > SELECT column1-column2 FROM table WHERE
> > name='johndoe';
> >
> > This works some of the time, however, I get weird
> > results for negative numbers. For example, when
> > column1=0 and column2=4995, I get:
> >
> > 18446744073709546621
> >
> > when really the answer should be -4995.
> 
> Is your columns defined as UNSIGNED? In this result
> of substraction will be 
> unsigned too.
> 
> 
> -- 
> For technical support contracts, goto
> https://order.mysql.com/?ref=ensita
> This email is sponsored by Ensita.net
> http://www.ensita.net/
>    __  ___     ___ ____  __
>   /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
>  / /|_/ / // /\ \/ /_/ / /__  
> [EMAIL PROTECTED]
> /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
>        <___/   www.mysql.com
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> 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
>  

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

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