Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004

    Unanswered: Substract unsigned fields

    I have table with two int unsigned field(a,b). I run statement like this:
    SELECT a-b AS x
    When the result became negative, it returns a big strange number. I know it has something to do with unsigned fields, but my question is how can i get the negative number without changing tables?
    And another thing is i alter table, and remove unsigned property, but the result didnt change, i think i should recreate the table and insert the data again to get the right neg numbers?

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    SELECT CAST(a-b AS SIGNED) AS x | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts