Skip to content

Convert positive data into negetive data (entire column) in Postgres Server

The current data in my table is:

  a   b
 -1   5
 -11  2   
 -5  32

My request is to convert every data of column a into negative value.

But how to update the positive values into the negative selecting the entire column?


Try this:

 Update table set a= 0-a where a >0