I'm relatively new to MySQL, and I was wondering if it was possible to prevent duplicate entries in a table pivot/mapping which has no primary key and a many-to-many relationship. A simple example:
table 1
table1ID
field
field
table 2
table2ID
field
field
pivot table
table1ID
table2ID
Since a many-to-many relationship would mean that a [single] primary key cannot be used, is there a concise way (1-2 queries) to prevent a duplicate entry (same table1ID, table2ID pair) from being added?
Edit: Obviously, this can be done through a SELECT and a loop through the results, but not only is that an extra call, but there's an extra loop.