Okay, I've done some investigation and discovered that the good stabilized articles and tags table ought to be such as this:

articles table:  article_id | article_text

tags table: tag_id | tag_text

article-tag table: article_id | tag_id

Now, things i attempt to do is: let us say I'm trying to find 3 tags for instance, "asp.internet", ".internet", "c#". It's very simple to retrieve articles that has these tags. But I'm not going this. Things I want would be to retrieve articles that has exactly these three tags or any two or one of these although not articles with 4 or even more tags including them. I'm not going searching result with "asp.internet", ".internet", "c#", "ruby". I would like only following labeled articles:

"asp.net", ".net", "c#"

.net", "c#"

"asp.net", ".net"

"asp.net", "c#"




What will be the right MySQL query for your?

I am convinced that a self join may be the way. Should you be querying by three tags, you'd join the content-tag table with itself 3 occasions, for instance. I am unsure how this could scale, though.

Update: with this particular approach you should perform a second query to exclude individuals matches with > 3 tags.