In my database, on a particular table there are several cloumns but the only 2 of interest right now are stone_id and upcharge_title. Individually they can each have duplicates, but they should never have a duplicate of BOTH of them having the same value.
For example stone_id can have duplicates as long as for each duplicate upsharge title is different, and vice verca. But say for example stone_id = 412 and upcharge_title = "sapphire" that combinitation should only occur once. I hope I am making this clear.
This is ok:
stone_id = 412 upcharge_title = "sapphire"
stone_id = 412 upcharge_title = "ruby"
This is ok:
stone_id = 412 upcharge_title = "sapphire"
stone_id = 413 upcharge_title = "sapphire"
This is NOT ok:
stone_id = 412 upcharge_title = "sapphire"
stone_id = 412 upcharge_title = "sapphire"
Can anyone tell me a query that will find duplicates in both fields? And if possible is there a way to set my data-base to not allow that?
I am using MySQL version 4.1.22
THANKS!!!
UPDATE: Thanks so much so far guys, Can anyone please tell me a query that could DELETE the duplicates but leave 1 copy. And please tell me how to set up the composite key. I do know how to setup primary and unique keys but not composite keys.
Thanks!!!