Re: Swappng Filds

From: <operationsengineer1(at)yahoo(dot)com>
To: Greg Lindstrom <greg(dot)lindstrom(at)novasyshealth(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Swappng Filds
Date: 2006-02-02 01:13:03
Message-ID: 20060202011303.48920.qmail@web33309.mail.mud.yahoo.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

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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2006-02-02 02:06:49 Re: Reverting from subtables to no subtables.
Previous Message operationsengineer1 2006-02-02 00:38:41 Re: