mysql选择具有所有条件的多对多 [英] mysql select many to many that have all condition

查看:159
本文介绍了mysql选择具有所有条件的多对多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只看这张照片:

如何选择dorm_id(70)?

how to I select dorm_id(70)?

dorm_id是家庭的想法,而设施是主题的属性,每个家庭都有一些设施,例如,家庭id 70具有这些设施(12,13,14,17,18),如何从dorm_id列中选择数字70

dorm_id is home ides , and facility is the propertray of theme , each home has some facility for example home id 70 has these facilities (12,13,14,17,18) , how to I select number 70 from dorm_id column .

进行搜索查询,找到具有所有功能的dorm_id

its a search query that find dorm_id that has all facility

提前感谢

推荐答案

我解决了这个问题,您所需要的只是您没有仔细看图片!

I solve the problem , all you need is you dont see carefully the picture !

SELECT dorm_id
FROM dorm
WHERE facility_id IN (12, 13, 14)
GROUP BY doctor_id
HAVING COUNT(DISTINCT ability_id) = 3

这篇关于mysql选择具有所有条件的多对多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆