Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Posts
    8

    Unanswered: Reversing the polarity/Sign of an Integer in Postgresql

    Dear Sirs et Madames,
    I am trying to access a column (age) in a Person table with the express interest of creating a view with an age column but with the polarity reversed, e.g an age of 34 years in the source table would have an age of -34 in the resultant age column in the view. Can anyone please advise on how I can achieve this?

    Thanks in advance

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Code:
    SELECT -1 * age
    FROM the_table_with_no_name

  3. #3
    Join Date
    Sep 2010
    Posts
    8
    Thanks! the answer (the one you posted) actually came to me while I was at the pharmacy getting some mosquito repellent, thanks for verifying its the right way to go.

Posting Permissions

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