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