Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 查找具有某些特定功能的所有类别_Mysql_Database_Database Design - Fatal编程技术网

Mysql 查找具有某些特定功能的所有类别

Mysql 查找具有某些特定功能的所有类别,mysql,database,database-design,Mysql,Database,Database Design,我有一个包含一些类别的表 Categories Table: -- category_id <-- primary key -- name 类别表: --category_id这里有一个解决方案: SELECT * FROM `categories` WHERE category_id in (select category_id from categories_features where feature_id = 3) AND category_id in (select

我有一个包含一些类别的表

Categories Table: 
-- category_id   <-- primary key
-- name
类别表:
--category_id这里有一个解决方案:

SELECT * FROM `categories` 
WHERE
category_id in (select category_id from categories_features where feature_id = 3) 
AND
category_id in (select category_id from categories_features where feature_id = 10)
Categories_Features Table: 
-- category_feature_id   <-- primary key
-- category_id
-- feature_id
SELECT * FROM `categories` 
WHERE
category_id in (select category_id from categories_features where feature_id = 3) 
AND
category_id in (select category_id from categories_features where feature_id = 10)