Re: Insert and Update together

2006-02-11 Thread George Law
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 values () on duplicate key update set x=2,y=5; unfortunately, the server I was testing this

Re: Insert and Update together

2006-02-11 Thread Andre Matos
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]

RE: Insert and Update together

2006-02-11 Thread Logan, David (SST - Adelaide)
--- -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

RE: Insert if Update failed without Select

2005-01-17 Thread Logan, David (SST - Adelaide)
@lists.mysql.com Subject: Re: Insert if Update failed without Select [EMAIL PROTECTED] wrote: Please also note hat UPDATE returns the number of records updated. If your UPDATE returns 0, you know that the record does not exist, and you might want to INSERT instead. There is one situation

Re: Insert if Update failed without Select

2005-01-16 Thread beacker
Please also note hat UPDATE returns the number of records updated. If your UPDATE returns 0, you know that the record does not exist, and you might want to INSERT instead. There is one situation where the number of records updated will return 0, yet the row exists. If you update the record

Re: Insert if Update failed without Select

2005-01-16 Thread sam wun
[EMAIL PROTECTED] wrote: Please also note hat UPDATE returns the number of records updated. If your UPDATE returns 0, you know that the record does not exist, and you might want to INSERT instead. There is one situation where the number of records updated will return 0, yet the row exists.

Re: Insert if Update failed without Select

2005-01-15 Thread Mattias J
At 2005-01-15 14:48, you wrote: Without using Select statement, how can I execute Insert SQL statement if Update action is failed? I may be asking for too much. If Select statemnet have to be used to determine the existence of a recordset, what is an efficient way to execute Insert if Update is

Re: Insert if Update failed without Select

2005-01-15 Thread Mattias J
Please also note hat UPDATE returns the number of records updated. If your UPDATE returns 0, you know that the record does not exist, and you might want to INSERT instead. At 2005-01-15 14:54, you wrote: At 2005-01-15 14:48, you wrote: Without using Select statement, how can I execute Insert

RE: INSERT OR UPDATE

2001-12-29 Thread Roger Baklund
* Joel Wickard I need to write a query that will insert data into a table if there is no row matching a pre-specified ID, but will update a row if it matches a pre-specified ID. Any pointers would be great. The REPLACE statement: URL: http://www.mysql.com/doc/R/E/REPLACE.html -- Roger