clear markdown compare help best fiddles feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3601434 fiddles created (48014 in the last week).

CREATE TABLE IF NOT EXISTS `products_cross` ( `id` int(6) unsigned NOT NULL, `GRPCD` int(10) unsigned NOT NULL, `brand` int(5) NOT NULL, PRIMARY KEY (`id`) ) DEFAULT CHARSET=utf8; INSERT INTO `products_cross` (`id`, `GRPCD`, `brand`) VALUES ('1', '33111', '107'), ('2', '33111', '103'), ('3', '44111', '105'), ('4', '44111', '101');
 hidden batch(es)


SELECT * FROM products_cross
id GRPCD brand
1 33111 107
2 33111 103
3 44111 105
4 44111 101
 hidden batch(es)


DELETE FROM `products_cross` WHERE GRPCD NOT IN (SELECT GRPCD FROM (SELECT * FROM products_cross ) pc WHERE brand=107)
 hidden batch(es)


SELECT * FROM products_cross
id GRPCD brand
1 33111 107
2 33111 103
 hidden batch(es)