SQL SELECT article by tags?

There is such scheme:
articles (id, name)
tags (id, name)
article_tags (article_id, tag_id)

In order to select articles that have at least 1 tag from purachina (let's say tag_id 1,2,3, 4)
I vtupuyu did 2 query: SELECT tag_id WHERE article_id in (1,2,3,4)
and then the same with the article: SELECT * WHERE id in (1,2,3,4)
Of it actually worked correctly.

But I now need to filter articles that have the tag. I tried also vtupuyu do (chose two of the array of article ids - chno is necessary or not + array_differ and then full articles were chosen, but it works not correctly :( . Sometimes it chooses something that is not needed.

Pomogite who is a guru SQL

UPDATE: all the rules, I'm a little stupid. Preapared statement WHERE IN, does not work. You need to first filtranti array tag_id something of type
tag_ids = array_filter($tag_ids, 'ctype_digit');
and then throw directly in SQL, implode(',', $tag_ids);

and with the crap that my method will work, although use of the decision response
July 8th 19 at 11:15
3 answers
July 8th 19 at 11:17
Solution
SELECT * FROM articles WHERE id NOT IN (SELECT article_id FROM article_tags)
July 8th 19 at 11:19
SELECT what your need FROM articles as a
LEFT JOIN article_tags as at ON a.id = at.article_id
WHERE at.the tag_id is NULL
July 8th 19 at 11:21
But I now need to filter articles that have the tag.

SELECT articles.ID, articles.Name
 FROM articles LEFT OUTER JOIN article_tags ON articles.ID = article_tags.article_id
 WHERE (article_tags.the tag_id IS NULL)

tag of Perechin
Create a table of this list.
CREATE TABLE [dbo].[tag_list](
 [ID] [int] NULL,
 [tag_id] [int] NULL
) ON [PRIMARY]

And get the set:
SELECT DISTINCT articles.ID, articles.Name
 FROM articles INNER JOIN article_tags ON articles.ID = article_tags.article_id 
 INNER JOIN article_tags ON tag_list.tag_id = tag_list.tag_id

Find more questions by tags MySQLSQL