MySql 프로그래밍에 익숙하지 않은 Im과 Im을 사용하여 내 기술을 향상시키는 프로젝트를 만듭니다. 열이있는 tblRecipe
이라는 테이블이 있습니다. 다른 테이블은 tblIngredients
이고 열은 IngredientId,RecipeId, IngredientName
입니다.서로 다른 값을 가진 동일한 열을 쿼리합니다.
예를 들어, RecipeOne에는 IngredientOne과 IngredientTwo가 필요합니다. RecipeTwo에는 IngredientOne, IngredientTwo 및 IngredientThree가 필요합니다. 내 프로그램은 입력에 대해 IngredientNames를 요청하므로 IngredientOne 및 IngredientTwo에 입력하면 RecipeOne 결과가 반환됩니다.
는 여기에 내가 IN 연산자는 다음과 일치 말처럼 것을 알고 내 코드
Select Recipename,Instructions
from tblREcipe where RecipeId in
(select recipeID
from tblIngredients
where Ingredientname in('IngredientOne','IngredientTWo')
);
입니다. 그 코드를 통해 두 가지 요리법을 모두 얻을 수 있습니다. 나는 AND와 동등한 것을 찾고 있습니다. "Ingredientname = ALL ('(IngredientOne', 'IngredientTwo')에서)" "을 시도했지만 행을 반환하지 않습니다.
이 프로젝트는 실습 프로젝트이므로 문제가 해결되면 테이블을 재구성하는 등의 변경 작업을 수행 할 수 있습니다. 조만간 연락 드리며 미리 감사드립니다.
감사합니다. – user1589687