Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UNIQUE combination of 2 fields?

Status
Not open for further replies.

svar

Programmer
Aug 12, 2001
349
GR
Is it possible in Mysql(4.01) with InnoDB to have a table
with say two fields and require that there are no
two rows with the same values of BOTH fields?
(obviously one dumm way is to create a third field declared as unique, that will be a combination or concatenation of some sort of the fields. Any smarter way?)

Thanks, svar
 
try this one:
ALTER TABLE tablename ADD UNIQUE newindex (field1, field2)

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top