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

The Archive Base Latest Questions

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

Is there a way to achieve something like: SELECT * FROM tb_values WHERE (value1,

  • 0

Is there a way to achieve something like:

SELECT *
FROM tb_values
WHERE (value1, value2, value3) SUBSET_OF
    ( SELECT value
      FROM tb_value
      WHERE isgoodvalue = true
    )

More information:
I have a table called projects. Each project has tags. A tag can be shared by multiple projects. There is a mapping table called projectTagMap. Now users use tags to filter the projects. Tags are selected using checkboxes on the UI. So a user selects several tags to filter the projects. Am supposed to select the projects from projects table that contains all the tags selected by the user.

  • 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-22T16:21:27+00:00Added an answer on May 22, 2026 at 4:21 pm

    From your pseudo code I guess that you want to check if a (dynamic) list of values is a subset of another list provided by a SELECT. If yes, then a whole table will be shown. If not, no rows will be shown.

    Here’s how to achieve that:

    SELECT *
    FROM tb_values
    WHERE 
        ( SELECT COUNT(DISTINCT value)
          FROM tb_value
          WHERE isgoodvalue = true
            AND value IN (value1, value2, value3)
        ) = 3
    

    UPDATED after OP’s explanation:

    SELECT *
    FROM project
      JOIN 
        ( SELECT projectid
          FROM projectTagMap
          WHERE isgoodvalue = true
            AND tag IN (tag1, tag2, tag3)
          GROUP BY projectid
          HAVING COUNT(*) = 3
        ) AS ok
        ON ok.projectid = project.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way of using the compound assignment operator to achieve something like
I would like to ask is there any way to achieve this functionality: I
Is there an easier way to achieve the following? var obj = from row
Is there a way to use LIKE and IN together? I want to achieve
is there way how to get name ov event from Lambda expression like with
How do I do something like the following SELECT ADDDATE(t_invoice.last_bill_date, INTERVAL t_invoice.interval t_invoice.interval_unit) FROM
When I do something like this: $boards = Doctrine_Query::create() ->select('bds.id') ->from('board bds') ->whereIn('bds.type', $boardtype)
What's the best way to achieve something like code folding, or the type of
Is there any way to achieve function overloading in C? I am looking at
This has been introduced in C# 4.0, but is there a way to achieve

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.