No George. I took a look there before sent this email to the mysql list. My
case it is not a duplicate record. What I want is that if the update in one
table happen, it will be proceed by an insert in another table like a log of
changes.
Andre
On 2/11/06 12:48 PM, "George Law" <glaw@stripped> wrote:
> Andre,
>
> I tried this a couple weeks ago... I think you want the "on duplicate"
> option for the INSERT query.
>
> depends what version you have... I think this was introduced in mysql 4.1
>
> insert into xxxx values (....) on duplicate key update set x=2,y=5;
>
> unfortunately, the server I was testing this on was running 4.0.x so I
> couldn't use it.
>
>
> http://dev.mysql.com/doc/refman/5.0/en/insert.html
>
>
>
> ----- Original Message -----
> From: "Andre Matos" <amatos@stripped>
> To: <mysql@stripped>
> Sent: Saturday, February 11, 2006 10:54 AM
> Subject: Insert and Update together
>
>
>> Hi List,
>>
>> I would like to know if it is possible to combine Insert and Update in one
>> SQL instruction. This is what I want to do:
>>
>> I have two tables: one where I will perform and Update replacing "m0" by
>> "scr". If MySQL find a "m0", it will need to perform an insert into a log
>> table including the information updated.
>>
>> I am trying to avoid writing a php4 program to do this. I am using MySQL
>> 4.1
>>
>> Thanks for any help.
>>
>> Andre
>>
>> --
>> Andre Matos
>> amatos@stripped
>>
>>
>>
>>
>> --
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
>>
>>
--
Andre Matos
amatos@stripped