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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique Constraints

Status
Not open for further replies.

Juice05

Programmer
Dec 4, 2001
247
US
I have a question concerning unique constraints. I have a table that has two fields that i need to apply unique constraints to. The first, lets call it incident_number, should be unique throughout the table and the second, unit_number, should only be unique per incident_number. If there is an incident_number of 5, then that should be the only incident_number in the entire table. Now for that incident_number (5) there can be many unit_numbers but only one can be 1, only one can be 2, etc...but there should be many unit_numbers that are 1 throughout the table. But only one 1 for incident_number 5. Any help would be greatly appreciated.
 
It sounds like you need to normalize your problem and use two tables, incident and unit.
 
U can use combined unique key constraint for those 2 fields.
I think this is what u wanted,right?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top