maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #01687
Re: newbie question
ok it with a innodb/transactional table
what about a aria/myisam/connect/federated table?
2014-06-12 0:45 GMT-03:00 Pavel Ivanov <pivanof@xxxxxxxxxx>:
> On Wed, Jun 11, 2014 at 8:32 PM, Roberto Spadim <roberto@xxxxxxxxxxxxx>
> wrote:
> > Guys, i'm with a "newbie" question
> > I need to swap a primary key value, for example:
> > create table test (
> > id int not null default 0,
> > other varchar(255) not null default '',
> > primary key(id)
> > );
> > insert into test (1,'a');
> > insert into test (2,'b');
> >
> > now i want that (2,'b') becomes (1,'b') and (1,'a') becomes (2,'a')
> >
> > the point is, how to do this, with only one UPDATE without duplicate
> column
> > id value? and without delete values?
>
> How about this:
>
> begin;
> update test set other = 'b' where id = 1;
> update test set other = 'a' where id = 2;
> end;
>
--
Roberto Spadim
SPAEmpresarial
Eng. Automação e Controle
Follow ups
References