Hi Kevin,
It works in mysql but not exactly as I need.
In my case it copied content of column2 into column1.
So, not exactly what I intended to achieve.
Thanks.
Igor
update mydata set column1 = column2, column2 = column1
On Thu, Sep 23, 2010 at 12:03 AM, Kevin (Gmail) wrote:
> update mydata set
ALTER TABLE tablename1 CHANGE column1 column2 VARCHAR(64), CHANGE column2
column1 VARCHAR(64)
Assuming the columns are varchar(64)
Jangita | +254 76 918383 | MSN & Y!: jang...@yahoo.com
Skype: jangita | GTalk: jangita.nyag...@gmail.com
-Original Message-
From: nixofortune [mailto:nix
update mydata set column1 = column2, column2 = column1
(works in sqlserver, can't try mysql at the moment)
You can select which rows by adding a where clause obviously.
I suppose that the field values are copied to a buffer which is the written
to the table at the end of the update (or row by row
sage-
From: Egor Shevtsov [mailto:nixofort...@googlemail.com]
Sent: Wednesday, September 22, 2010 4:14 PM
To: MySQL mailing list
Subject: Re: Swap data in columns
Hi Rolando,
This is perfect solution I was looking for.
Why do you use left join here? It looks like inner join works fine as well.
Th
This is even better!
JW
On Wed, Sep 22, 2010 at 2:27 PM, Steve Staples wrote:
> What about:
> select `id`, `column1` as 'column2', `column2` as 'column1';
>
> Steve
>
>
>
> On Wed, 2010-09-22 at 13:06 -0500, Johnny Withers wrote:
> > Couldn't you just rename the columns?
> >
> > JW
> >
> >
> >
Hi Rolando,
This is perfect solution I was looking for.
Why do you use left join here? It looks like inner join works fine as well.
Thanks.
Rolando Edwards wrote:
I ran these commands:
use test
DROP TABLE IF EXISTS mydata;
CREATE TABLE mydata (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,column1
Hi Rolando,
This is perfect solution I was looking for.
Why do you use left join here? It looks like inner join works fine as well.
Thanks.
>
>
>
>
>
> Rolando Edwards wrote:
>
> I ran these commands:
>
> use test
> DROP TABLE IF EXISTS mydata;
> CREATE TABLE mydata (id INT NOT NULL AUTO_INCREME
What about:
select `id`, `column1` as 'column2', `column2` as 'column1';
Steve
On Wed, 2010-09-22 at 13:06 -0500, Johnny Withers wrote:
> Couldn't you just rename the columns?
>
> JW
>
>
> On Wed, Sep 22, 2010 at 11:53 AM, Rolando Edwards
> wrote:
>
> > I ran these commands:
> >
> > use tes
Couldn't you just rename the columns?
JW
On Wed, Sep 22, 2010 at 11:53 AM, Rolando Edwards
wrote:
> I ran these commands:
>
> use test
> DROP TABLE IF EXISTS mydata;
> CREATE TABLE mydata (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,column1
> CHAR(1),column2 CHAR(2));
> INSERT INTO mydata (colum
I ran these commands:
use test
DROP TABLE IF EXISTS mydata;
CREATE TABLE mydata (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,column1
CHAR(1),column2 CHAR(2));
INSERT INTO mydata (column1,column2) VALUES ('a','z'), ('b','y'), ('c','x'),
('d','w'), ('e','v');
SELECT * FROM mydata;
UPDATE mydata A L
10 matches
Mail list logo