G
G
gofree2018-03-24 00:12:05
MySQL
gofree, 2018-03-24 00:12:05

How to create unique values ​​for multiple records for DUPLICATE KEY UPDATE?

CREATE TABLE `mt_viewed` (
  `id` int(11) NOT NULL,
  `product_id` int(11) NOT NULL,
  `PHPSESSID` varchar(32) NOT NULL,
  `putdate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `product_id` (`product_id`,`PHPSESSID`,`putdate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

The table is needed for the last viewed products by the user. Maybe I'm doing something wrong? But unique values ​​are shown only for putdate

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question