Oops, I meant to send this to the list so that everyone could benefit, not
just to Andre.
--
Rhino
----- Original Message -----
From: "Rhino" <[EMAIL PROTECTED]>
To: "Andre Matos" <[EMAIL PROTECTED]>
Sent: Saturday, February 11, 2006 12:11 PM
Subject: Re: Insert and Update together
----- 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.
Have a look at the these two pages from the MySQL manual; I think one or
the other of them will do what you want to do:
http://dev.mysql.com/doc/refman/4.1/en/replace.html
http://dev.mysql.com/doc/refman/4.1/en/insert-on-duplicate.html
--
Rhino
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.15.6/257 - Release Date: 10/02/2006
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]