Is there a way to have a table definition that bases its Non-Duplication on two fields?
By this i have 3 columns gid, cid, price
Criteria:
- There can only be 1
cid
for 1gid
- There can be multiple
cid
's as long as there are multiplegid
's and criteria 1 is not violated
I basically want to have the restriction in the Table Design, if possible. Not sure if its possible just figured i would ask.
Edit (2010-08-27 11:18am CST)
Ok a little clarification, i have two indexes as well, one on gid
and other is on cid
, can i have the two indexes determine Uniqueness? The table is basically a Join table since the two tables drawn in have a 1-Many relationship, in so far as their counterpart is unique to its id.
Table/Indexes declaration:
- gid {Numeric:Long} (Primary: No, Unique: No, Ignore Nulls: No) [FK]
- cid {Numeric:Long} (Primary: No, Unique: No, Ignore Nulls: No) [FK]
- price {Numeric:Single}
Usage:
- cid 1-Many gid
- cid is derived from tblCat (as the PK)
- gid 1-Many cid
- gid is derived from tblGrp (as the PK)