Create a distinctive index for the (user, label, empid) . As a result, the database will prohibit the creation of any duplicate entries.
ALTER TABLE pms_users
ADD UNIQUE INDEX (user, label, empid);
Solution 2:
ALTER TABLE pms_users ADD CONSTRAINT pms_users_unq UNIQUE (`user`, `label`, `agent`);
INSERT IGNORE INTO `pms_users`
(`user`, `label`, `agent`, `empid`)
VALUES ('some_user', 'some_label', 'some_agent', 123)
0 Comments