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

  • Home
  • SEARCH
  • 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 3215504
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:11:08+00:00 2026-05-17T15:11:08+00:00

Does someone have a good idea/solution how to achieve this? Situation is: I have

  • 0

Does someone have a good idea/solution how to achieve this?

Situation is:
I have the tables ‘releases’ and ‘ntags’,
related via ‘releases_ntags’ (containing ‘release_id’ and ‘ntag_id’)

And I would like to fetch results for releases via the ntag’s ‘slug’.

I manage to have this semi-working:

sql

SELECT r.id, r.name
FROM releases r
LEFT JOIN ntags_releases rt ON rt.release_id = r.id
JOIN ntags nt ON nt.id = rt.ntag_id
AND (nt.name = ('TAG_1') OR nt.name = ('TAG_2'))
GROUP BY r.id, r.name

So far so good, but this gives me all releases with "TAG_1" PLUS all releases with "TAG_2" (and off course those with both tags).

But what I need is to only get the intersection of the tags, say:

"releases with ‘TAG_1’ AND ‘TAG_2’"

So i tried with:

...
AND (nt.name = ('TAG_1') AND nt.name = ('TAG_2'))
... 

But this leads in an empty result.
Does anyone have an idea how to achieve this? Don’t know how to go further on this and would really appreciate some input!

thx

  • 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-17T15:11:08+00:00Added an answer on May 17, 2026 at 3:11 pm

    You can demand that two distinct ntags are present in the having clause:

    SELECT  r.id, r.name
    FROM    releases r
    JOIN    ntags_releases rt
    ON      rt.release_id = r.id
    JOIN    ntags nt
    ON      nt.id = rt.ntag_id
    WHERE   nt.name in ('TAG_1', 'TAG_2')
    GROUP BY
            r.id, r.name
    HAVING
            COUNT(distinct nt.name) = 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started to read about this new technology... Does someone have some knowledge
Does someone have any tips/advice on database design for a web application? The kind
I want to generate Keywords for my CMS. Does someone know a good PHP
Does someone know if it is possible to modify the JVM settings at runtime
Does someone knows if it's possible to dynamically create a call chain and invoke
Does anyone know of any documentation by MS or someone else that lays out
Can someone please explain what the & does in the following: class TEST {
Does Google force employees who have offers from Facebook to leave immediately?
Does the Java language have delegate features, similar to how C# has support for
Does anybody know any good resources for learning how to program CIL with in-depth

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.