NaN
Новичок
Помогите составить SQL запрос
Как вывести пользователей которые купили продукт product = '50' AND version = 'new',
но не покупили продукт product = '50' AND version = 'old'
CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL auto_increment,
`user` int(10) unsigned NOT NULL,
`product` int(10) unsigned NOT NULL,
`version` varchar(64) default NULL,
PRIMARY KEY (`id`),
KEY `user` (`user`),
KEY `product` (`product`)
) ENGINE=MyISAM;
INSERT INTO `products` VALUES (1, 5, 50, 'old');
INSERT INTO `products` VALUES (2, 5, 50, 'new');
INSERT INTO `products` VALUES (3, 6, 50, 'new');
Как вывести пользователей которые купили продукт product = '50' AND version = 'new',
но не покупили продукт product = '50' AND version = 'old'
CREATE TABLE `products` (
`id` int(10) unsigned NOT NULL auto_increment,
`user` int(10) unsigned NOT NULL,
`product` int(10) unsigned NOT NULL,
`version` varchar(64) default NULL,
PRIMARY KEY (`id`),
KEY `user` (`user`),
KEY `product` (`product`)
) ENGINE=MyISAM;
INSERT INTO `products` VALUES (1, 5, 50, 'old');
INSERT INTO `products` VALUES (2, 5, 50, 'new');
INSERT INTO `products` VALUES (3, 6, 50, 'new');