I have a data with the following sample data:
ID CID Name ImageLocation Order
1 1 Suit Jacket Content/Berwin/Content/Images/SuitJacket.jpg 1
2 1 Trousers Content/Berwin/Content/Images/Trousers.jpg 2
4 2 Jumper Content/Berwin/Content/Images/Jumper.jpg 1
5 3 Trousers Content/Berwin/Content/Images/Trousers.jpg 1
6 4 Suit Jacket Content/Berwin/Content/Images/SuitJacket.jpg 1
ID is PK, CID is FK and order is the order to be shown in not an Order FK
Is there anyway to enforce that the number within the Order column is unique within the scope of its CID. I.e. I wouldn’t be able to insert 1 or 2 when CID is 1?
Yes, this is possible.
You can add a new ‘Unique Key’ to your database.
CIDandOrder