Kevin Carlson <[EMAIL PROTECTED]> wrote:
> I have a table with four columns, the first three of which are combined
> into a unique key:
>
>
> create table Test {
> cid int(9) NOT NULL default '0',
> sid int(9) NOT NULL default '0',
> uid int(9) NOT NULL default '0',
> rating tinyint(1) NOT NULL default '0',
> UNIQUE KEY csu1 (cid,sid,uid),
> KEY cid1 (sid),
> KEY sid1 (sid),
> KEY uid1 (sid),
> } TYPE=InnoDB;
>
>
> I am using a REPLACE query to insert a row if it doesn't exist and
> replace an existing row if one does exist:
>
> REPLACE into TEST (cid, sid, uid, rating) values (580, 0, 205, 1)
>
> In the case of this particular row, a row already exists with the
> concatenated key of 580-0-205 and I am getting a duplicate key error. I
> thought REPLACE was supposed to actually replace the contents of the row
> if one exists. Does anyone have any ideas as to why this would be
> causing a duplicate key error?
>
Works fine for me. The above CREATE TABLE statement has some syntax errors. What
exactly does CREATE TABLE look like?
What version of MySQL do you use?
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Victoria Reznichenko
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]