Re: Swappng Filds - Mailing list pgsql-novice

From
Subject Re: Swappng Filds
Date
Msg-id 20060202011303.48920.qmail@web33309.mail.mud.yahoo.com
Whole thread Raw
In response to Swappng Filds  (Greg Lindstrom <greg.lindstrom@novasyshealth.com>)
List 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

this might be way off base, but why not leave the data
and swap the column names?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

pgsql-novice by date:

Previous
From:
Date:
Subject: Re:
Next
From: Tom Lane
Date:
Subject: Re: Reverting from subtables to no subtables.