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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:43:59+00:00 2026-06-15T09:43:59+00:00

I have a project where I need to select only the users that answered

  • 0

I have a project where I need to select only the users that answered to some questions in a certain way (based on a filter).

The filter table (filter) looks like this

   question |   answer  

   Q1       |    A  
   Q2       |    B 

The user table (answers) looks like this

user | question | answer  

  1  |    Q1    |    A  
  1  |    Q2    |    D  
  2  |    Q1    |    A  
  2  |    Q2    |    B 

How can I select from the user table only the user(s) that match the filter?
I tried

"SELECT user FROM answers WHERE (question = Q1 AND answer = A) 
             AND (question = Q2 AND answer = B)" 

and it doesn’t work — I get an empty result. Thank you.

  • 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-06-15T09:44:00+00:00Added an answer on June 15, 2026 at 9:44 am

    try this

    select answers.user
    from filter, answers
    where filter.question=answers.question and filter.answer=answers.answer
    group by answers.user having count(answers.question)=2
    

    or

    select user
    from answers
    where user not in 
    (select distinct a.user from answers a, filter f 
    where a.question=f.question and a.answer!=f.answer)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large project but I need only some folders in my svn
The Junits I have in my project need to load property files from the
I have a project where I need to monitor changes in a 3rd party
I have a project where I need to compare multi-chapter documents to a second
I have a project where I need to update a labels text from inside
i need to have one project on asp.net mvc 1 but i want to
I have a college project where I need to extend an existing spreadsheet application
I have a project in which I would need to copy files found within
I have a project in Java and I need to make a code listing
I have a project in which I need to display multiple UITableView instances inside

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.