Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6090093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:10:28+00:00 2026-05-23T12:10:28+00:00

Alright, I have done some research and found out that a good normalized articles

  • 0

Alright, I have done some research and found out that a good normalized articles and tags table should be like this:

articles table:  article_id | article_text

tags table: tag_id | tag_text

article-tag table: article_id | tag_id

Now, what I try to do is this: let’s say I am searching for 3 tags for example, “asp.net”, “.net”, “c#”. It is very easy to retrieve articles which has these tags. But I don’t want this. What I want is to retrieve articles which has exactly these three tags or any two or one of them but not articles with 4 or more tags including them. I don’t want a search result with “asp.net”, “.net”, “c#”, “ruby”. I want only following tagged articles:

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

.net", "c#"

"asp.net", ".net"

"asp.net", "c#"

"c#"

"asp.net"

".net"

What would be the right MySQL query for that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:10:28+00:00Added an answer on May 23, 2026 at 12:10 pm

    I’m thinking that a self join might be the way. If you were querying by three tags, you would join the article-tag table with itself 3 times, for example. I’m not sure how this would scale, though.

    Update: with this approach you would need to do a second query to exclude those matches with > 3 tags.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, currently I have my SWF hitting a php file that will go and
Is it alright to expect that the user using the back end will have
Alright, so I'm running into an issue with my code. What I have done
Alright, possible a naive question here. I have a service that needs to log
Alright, I have library I wrote in C that reads a file and provides
Alright heres the deal. I have a sports app that i want to update
Alright. The idea is that I have a jCarousel list that displays 3 items
Alright I know that the .closest() have been discussed before, but I have been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.