thanks :-) i get too ! there are my sql queries
alter table tbllinkpersondept
add unique UniquePersonRef(PersonRef),
add unique UniqueDeptRef(DeptRef);
insert into tbllinkpersondept values(1, 1),(1,2);
ERROR 1062: Duplicate entry '1' for key 2
Okay ,i think i didn't describe the question clearly! what i want is a table with two sepatate field each marked as a primary key and "each one" preventing duplicate entries in the separate fields. that is :when i insert a value (1,2),i must not insert another value such as column1=1 or...
i think this eg. can describe the problem above, when we use one of the below:
alter table services
add foreign key (`Customer ID`) references `customer`.`Customer ID` on delete cascade
or
alter table services
add foreign key (`Customer ID`) references customer(`Customer ID`) on delete...
LittleSmudge (Programmer) Jun 25, 2003
What I WANT is to be able to enter
PersonRef DeptRef
1 1
2 1
3 1
1 2
4 2
5 2
6 2
3 1 <<< This to be NOT allowed because it is a repeat...
After read this thread ,i can't solve the problem ,i want to know the differences between the:
CREATE TABLE tblLinkPersonDept (
PersonRef MediumInt,
DeptRef MediumInt,
PRIMARY KEY ( PersonRef, DeptRef )
)type=innodb;
and the:
alter table tbllinkpersondept
drop primary key;
alter table...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.