[thelist] mysql - unique index combos
David Siedband
technique at oceanicsky.com
Tue Feb 22 17:41:35 CST 2005
I have some index tables in mysql (v4.x) that have two fields, each
being a unique ID from another table. What I'd like to do is allow a
combination of keys to be entered only once.
for example:
+-------------+-----------------+
| ProjectID | DocumentID |
+-------------+-----------------+
| 327 | 440 |
| 446 | 743 |
| 226 | 444 |
| 446 | 743 |
| 226 | 444 |
+-------------+-----------------+
Is there a way to declare a unique index on these two fields, such that
when someone tries to enter a combination that is already in the table
it doesn't enter a duplicate entry? ...or do I need to put this logic
in my application instead?
thx
--
David Siedband
generation-xml.com
More information about the thelist
mailing list