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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:32:07+00:00 2026-06-09T14:32:07+00:00

Im just new to MySql Programming and Im creating a project to enchance my

  • 0

Im just new to MySql Programming and Im creating a project to enchance my skills.
I have a table called tblRecipe which has the columns RecipeId, RecipeName and Instructions. the other table is called tblIngredients which has the columns IngredientId,RecipeId, IngredientName.

Now for example,RecipeOne needs IngredientOne and IngredientTwo to make, RecipeTwo needs IngredientOne,IngredientTwo and IngredientThree to make.
My programs asks the IngredientNames for the input so when i put in IngredientOne and IngredientTwo it should give me back the result RecipeOne.

Here is my code

Select Recipename,Instructions 
from tblREcipe where RecipeId in 
         (select recipeID 
         from tblIngredients 
         where Ingredientname in('IngredientOne','IngredientTWo')
         );

I know that the IN operator is like saying match any of the following.
So with that code it gives me both recipes.
Im looking for an equivalent of AND.
I tried “Ingredientname =ALL(in(‘IngredientOne’,’IngredientTwo’))”
but it does not return any rows.

Im open to any changes such as restructuring the tables if that fixes the problem since this is just a practice project.Hope to hear from you soon guys and thank you in advance.

  • 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-09T14:32:08+00:00Added an answer on June 9, 2026 at 2:32 pm

    You also need to count the number of instance of the records that match to the number of ingredients. Like this one below:

    Select a.Recipename, 
           a.Instructions 
    FROM   tblREcipe a INNER JOIN
             (
                 SELECT   recipeID,
                          COUNT(IngredientId)
                 FROM     tblIngredients 
                 WHERE    Ingredientname IN ('IngredientOne', 'IngredientTWo')
                 GROUP BY recipeID
                 HAVING   COUNT(IngredientId) = 2    -- the number of ingredients
                                                     -- should somehow dynamic
             ) b ON a.recipeID = b.recipeID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just creating a new table using MySQL Query Browser, and noticed there's
I have an existing application (with MySQL DB). I just got a new requirement
I am just new to programming in Unix and have a small issue that
i'm new to mySQL. i have created a join table from two tables: students
I've just created a new MySQL user with a password and granted them all
I am just a new beginner in MySQL and I wanted to write the
I'm new to mySQL and as such am just looking for a very simple
I am pretty new to PHP and MySQL and I just can't figure this
I just installed ruby on rails on windows. install mysql and created a new
i'm just new to iOS Programming, so appreciate for any help. I'm trying to

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.