开发者

mysql unique (multiple keys )

hi guys I have attached a pic for the table structure..

mysql unique (multiple keys )

The problem

I am adding a new record to db and it says its duplicated when title is different is there something wrong on the way I have structured all three to be unique?

I need the title,parent, eid to be unique as only if all three have the same data in it, if one of the fields is different treat it as a non duplicate

UPD开发者_运维知识库ATED The title bla bla does not exist on db yet

INSERT INTO `test_table` (`id`,`title`,`parent`,`lang`)VALUES(1,'Bla bla',0,25);


The error is because of the duplicate value for id and not for title.

id is your primary key so duplicates are not allowed. Also your schema says that id is an auto increment field, so you need not enter its value explicitly.


That's because there's already a row with id=1 OR because the index on the table is broken, check this forum thread about how to fix it with phpmyadmin.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜