This code didn’t works as expected. I want to select all the posts that have the TAGS 561, 562, together or separately, but without any tag that is not present here->>> IN (561, 562)
SELECT post_id_post
FROM post_has_tags
WHERE tags_id_tags IN (561, 562)
HAVING COUNT(tags_id_tags) <= 2
post_id_post tags_id_tags
600 561
600 562
600 917 // 917 is not inside IN (561, 562)
But this code will output the post 600. It’s wrong, the correct output should be no results.
thanks
Try this:
I don’t want to be less than Phil, so I’m adding my fiddle too 🙂