Hi,

When you use the replace command if the row does not exist it is inserted.

MySQL Reference Manual:

Section 14.1.6

REPLACE works exactly like INSERT, except that if an old record in the table
has the same value as a new record for a PRIMARY KEY or a UNIQUE index, the
old record is deleted before the new record is inserted 


Regards,

Laercio.

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Harald Fuchs
Sent: quinta-feira, 30 de setembro de 2004 11:39
To: [EMAIL PROTECTED]
Subject: Re: (if !update then insert) sequence - result Duplicate key :(

In article <[EMAIL PROTECTED]>,
"Laercio Xisto Braga Cavalcanti" <[EMAIL PROTECTED]> writes:

> Hi,
> To solve this you can use the REPLACE command.

The problem is that Aleksandr wants to increment a counter, not set it to
some fixed value.  How could you use REPLACE for that?


--
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