This is my table
dd_set
id dd_id
1037 19
1037 5
1037 20
1037 3
1037 7
1038 1
1038 7
i want to find find id where dd_id=19 and dd_id =5 and dd_id=20
is this possible to do in mysql?
The simplest way would be
select id from dd_set
where dd_id in (19,5,20)
group by id
having count(distinct dd_id) = 3
Try This
SELECT DISTINCT id FROM dd_set
WHERE dd_id IN(19,5,20);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.