Tables
CREATE TABLE `products` ( `id` int(11) NOT NULL AUTO_INCREMENT, `category` int(11) NOT NULL, `title` varchar(120) NOT NULL COMMENT 'Название', `power` decimal(4,1) NOT NULL COMMENT 'Мощность', `luminous` int(5) NOT NULL COMMENT 'Световой поток', `price` decimal(10,2) NOT NULL COMMENT 'Цена', `hash` varchar(255) DEFAULT NULL COMMENT 'Хэш картинки', `width` int(4) DEFAULT NULL COMMENT 'Длина', `height` int(4) DEFAULT NULL COMMENT 'Ширина', `depth` int(4) DEFAULT NULL COMMENT 'Толщина', `weight` decimal(7,3) DEFAULT NULL COMMENT 'Вес', PRIMARY KEY (`id`), KEY `category` (`category`), FULLTEXT KEY `title` (`title`), CONSTRAINT `products_ibfk_1` FOREIGN KEY (`category`) REFERENCES `category` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CREATE TABLE `product_bracing` ( `id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL COMMENT 'Товар', `bracing` char(4) NOT NULL COMMENT 'Тип крепления', PRIMARY KEY (`id`), KEY `product_id` (`product_id`), CONSTRAINT `product_bracing_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=432 DEFAULT CHARSET=utf8 An example of my request
SELECT `t`.`id` AS `t0_c0`, `t`.`category` AS `t0_c1`, `t`.`title` AS `t0_c2`, `t`.`power` AS `t0_c3`, `t`.`luminous` AS `t0_c4`, `t`.`price` AS `t0_c5`, `t`.`hash` AS `t0_c6`, `t`.`width` AS `t0_c7`, `t`.`height` AS `t0_c8`, `t`.`depth` AS `t0_c9`, `t`.`weight` AS `t0_c10`, `get_bracing`.`id` AS `t1_c0`, `get_bracing`.`product_id` AS `t1_c1`, `get_bracing`.`bracing` AS `t1_c2` FROM `products` `t` LEFT OUTER JOIN `product_bracing` `get_bracing` ON (`get_bracing`.`product_id`=`t`.`id`) WHERE (get_bracing.bracing='cons' AND get_bracing.bracing='lyra' AND category=8) ORDER BY t.id DESC There is a products table, it has a connection to the products_bracing table - 1: M, in the products_bracing table there is a 'bracing' field that takes the value 'cons' or 'lyra'. The result of selecting all the fields displays:
products.id | products_bracing.bracing 3 | cons 3 | lyra 4 | cons 5 | cons how to make a request to get products where products_bracing.bracing = 'cons' and products_bracing.bracing = 'lyra' , I always get emptiness for some reason