mysql query question

Steve Prior sprior at geekster.com
Tue Jul 15 07:22:50 PDT 2003


>>
>>http://www.mysql.com/doc/en/REPLACE.html
>>
>>REPLACE works exactly like INSERT, except that if an old record in the ...
> 
> I forgett to say that I need to update one row like a = a + 10 that replace
> can't do.
> 
> A solution is:
> 
> set @w = 0;
> select @w := value from table where id = "20030713";
> delete from table where id = "20030713";
> insert into table values ("20030713", @w + 20);
> 
> if someone is interested in it too
> 
> Alexander Newald
> 
> 

Then how about

set @w = 0;
select @w := value from table where id = "20030713";
replace table values ("20030713", @w + 20);  (or whatever the exact replace 
syntax is)

That way you still combine the delete/insert into one operation that mysql
can optimize.

Steve

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe blfs-support' in the subject header of the message



More information about the blfs-support mailing list