How to make a combination of fields unique?

someboddy

Registered User.
Local time
Today, 07:22
Joined
Aug 27, 2009
Messages
28
I know you can set a single field in a table to be unique(not allowing duplications), but is there a way to do it to a combination of fields? For example, if I have a day field and an hour field, and I want to set it that there can only be one row in the table for each combination of day and hour:
Day 1 Hour 1
Day 1 Hour 2 - allowed - it's the same day but with a different hour
Day 2 Hour 1 - allowed - it's the same hour but with a different day
Day 1 Hour 1 - not allowed - same day and same hour.

Now, I know it can be done by setting those fields to be a multifield PK, but I don't want to make them PK, cause it'll eventually add up to tables with 4+ fields PK, and that's a disaster...

So, any suggestions?
 
Yes, just bring up the indexes dialogue from the menu while in table design mode. There, you'll be allowed to enter multiple columns for your key.
 
When I do that, each field that I put there as an index is unique by itself. I need to make a combination of fields unique.
 

Users who are viewing this thread

Back
Top Bottom