Swappng Filds

From: Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Swappng Filds
Date: 2006-01-18 20:52:45
Message-ID: 43CEAA9D.10905@novasyshealth.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello-
I have a table with values in two columns that I want to swap; that is,
I want the value in column A to now be in column B and the value in
column B to be in column A. I tried...

UPDATE my_table SET A=B, B=A WHERE mycontition = True

But that seemed to place the value of column B into A, then the new
value of A into B, so both A and B contained value B. Is there a common
technique to accomplish this?

Thanks,
--greg

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-01-18 20:54:00 Re: Huge size of Data directory
Previous Message s anwar 2006-01-18 01:23:56 Re: alter table set tablespace over nfs getting stuck