方法:
unique index(字段一,字段二)
例子:
CREATE TABLE IF NOT EXISTS `ppserver`.`eventTable`( `userId` INT UNSIGNED NOT null, `taskId` INT UNSIGNED NOT null, `date` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `createTime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `endTime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `taskStatus` INT DEFAULT NULL, `addGoldCoin` int DEFAULT NULL, `addCash` FLOAT DEFAULT NULL, `eventId` INT UNSIGNED AUTO_INCREMENT DEFAULT null, unique index(`userId` ,`taskId`,`date`), PRIMARY KEY ( `eventId`)