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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:43:39+00:00 2026-05-21T12:43:39+00:00

I am new to mySql and am trying to do a filtering query from

  • 0

I am new to mySql and am trying to do a filtering query from one column using data from a few other tables. For example, I can pull a table of names, a table of their marks in the sports classes, and a table of sports.

I can query this database using

WHERE beta.sport = 'basketball'; pulls all of the beta id’s for basketball and effectively all the kids who play basketball. Now I want to find all the kids who played basketball AND Lacrosee.

WHERE beta.sport = 'basketball' AND beta.sport = 'lacrosse';

The problem is that the query executes fine, but returns zero results. I know by manually looking at my data, that there are kids who play basketball and lacrosse. How do you filter the kids who play both basketball and lacrosse? OR returns kids that play either lacrosse or basketball. I only want to return kids that play both and the only access I have to the list of sports is from this one table beta.

TABLE beta

beta_id - sport ||
1  - basketball ||
2  - lacrosse ||
3  - football ||
4  - basketball ||
  • 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-21T12:43:39+00:00Added an answer on May 21, 2026 at 12:43 pm
    SELECT  *
    FROM    names n
    WHERE   (
            SELECT  COUNT(*)
            FROM    beta b
            WHERE   b.sport IN ('basketball', 'lacrosse')
                    AND b.name = n.id
            ) = 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the MySql.Data dll from MySql and trying to execute a query to
I am new to MySQL and PHP(as you can probably tell) and I was
I'm trying to connect to a mysql server at dreamhost from a php scrip
I'm trying to import about 10K rows of UTF-8 encoded data into a new
I'm very new at MySQL and I'm trying to execute some commands, wait a
I'm trying to connect to a different machine: $this->_connection = new PDO(mysql: host=MYSQL_SERVER; dbname=MYSQL_DATABASE,MYSQL_USER,
I'm trying to connect to a hosted MySQL database from my Ruby script. require
I'm trying to put together a MYSQL query that will count the number of
I am (as most ) coming from a mySQL background trying to switch over
I'm working in phpMyAdmin and I'm new to creating MySQL 5.0.45 triggers. I'm trying

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.