Hi Andre,

I don't believe 4.1 is able to do this. Version 5.0.18 (latest) has the
ability to use triggers to do exactly what you describe. You may have to
consider an upgrade to achieve this functionality or do something in
php.

Regards 



---------------------------------------------------------------
********** _/     **********  David Logan 
*******   _/         *******  ITO Delivery Specialist - Database
*****    _/            *****  Hewlett-Packard Australia Ltd
****    _/_/_/  _/_/_/  ****  E-Mail: [EMAIL PROTECTED]
****   _/  _/  _/  _/   ****  Desk:   +618 8408 4273
****  _/  _/  _/_/_/    ****  Mobile: 0417 268 665
*****        _/       ******    
******      _/      ********  Postal: 148 Frome Street,
********   _/     **********          Adelaide SA 5001
                                      Australia 
i    n    v    e    n    t                                   
---------------------------------------------------------------

-----Original Message-----
From: Andre Matos [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 12 February 2006 2:23 PM
To: George Law; mysql@lists.mysql.com
Subject: Re: Insert and Update together

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" <[EMAIL PROTECTED]> 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" <[EMAIL PROTECTED]>
> To: <mysql@lists.mysql.com>
> 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
>> [EMAIL PROTECTED]
>> 
>> 
>> 
>> 
>> -- 
>> MySQL General Mailing List
>> For list archives: http://lists.mysql.com/mysql
>> To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
>> 
>> 

-- 
Andre Matos
[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to