mysql update unique index
- by atno
Is there a way to say UPDATE items SET qty=10 WHERE **unique key** instead of saying UPDATE items SET qty=10 WHERE userID=1 AND listID=10 and itemID=100 on the following table?
CREATE TABLE IF NOT EXISTS `items` (
`userID` int(20) NOT NULL,
`listID` int(20) NOT NULL,
`itemID` int(20) NOT NULL,
`qty` int(10) NOT NULL,
UNIQUE KEY `unique` (`userID`,`listID`,`itemID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;