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 7535647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:21:26+00:00 2026-05-30T06:21:26+00:00

I need help writing a query. What I’m trying to do, is to check,

  • 0

I need help writing a query. What I’m trying to do, is to check, if any category_id have both (or even more) given tag_id’s. I’m looking for most optimal query…

if any category_id have both (or even more) tag_id’s

id              int(10) NO  PRI     auto_increment
client_id       int(10) YES         
category_id     int(10) YES         
tag_id          int(10) YES 

sample data:

41  1   137 183
40  1   137 124
39  1   136 179
38  1   136 124
62  1   143 263
61  1   143 200
60  1   143 135
59  1   143 131
58  1   143 125
  • 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-30T06:21:28+00:00Added an answer on May 30, 2026 at 6:21 am
    SELECT category_id
    FROM Mytable
    WHERE tag_id IN(183, 200)
    GROUP BY category_id
    HAVING COUNT(Distinct tag_id) = 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a little help writing a query. I have this data... vDir iNumber
I need help in writing a query, below i have written classes with needful
I need help with writing a select clause query. For example, lets say I
I could use some help writing a SQL query. I'm trying to display some
I need help writing a conditional where clause. here is my situation: I have
Need help in writing the query to get the last month data as well
I need help with writing a query (mySQL) to Total number of users in
I need help writing a T-SQL query that will generate 52 rows of data
Need help from you all in writing up this query. Running SQL 2005 Standard
I need help writing a query that will validate a first expression and than,

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.