How i can make 2 unique_index validation
How i can make 2 unique_index validation
Cdya
Posts: 12Questions: 5Answers: 0
ALTER TABLE yoourtable
ADD UNIQUE unique_index
(Name
, Status
);
I need to make 2 unique_index
+-----------------------------------+------------+
| Name | Status |
+-----------------------------------+------------+
| asya | 1 |
| cdya | 1 |
| asya | 2 |
| cdya | 2 |
+-----------------------------------+------------+
I need to like this table but no duplicate when status same equal.
need to make it validation server-side
Thank you.
This discussion has been closed.
Answers
ALTER TABLE yoourtable ADD UNIQUE unique_index(Name, Status);
If you are using the Editor PHP or .NET libraries for Editor you can also use the
unique
validator.Allan
this does not answer I don't know how I can do unique index in 2 column
Sorry yes, the built in
unique
validator will only work with a single column. You'd need to use a custom validator to validate across multiple columns.Regards,
Allan