SELECT
GROUP_CONCAT(`recipe_ingredient`.`recipeId`)
FROM `recipe_ingredient`
WHERE `recipe_ingredient`.`ingredientId`
IN(4,11,33,36,54,117,135,136,178,185,218,312,348,378)
ORDER BY `recipeId` ASC
but i want above query "IN" value i getting from other table so i am creating new query but i am not getting result
SELECT
GROUP_CONCAT(`recipe_ingredient`.`recipeId`)
FROM `recipe_ingredient`
WHERE `recipe_ingredient`.`ingredientId`
IN(
SELECT
GROUP_CONCAT(`ingredient`.`ingredientId`
ORDER BY `ingredient`.`ingredientId` ASC ) AS unlinkIng
FROM `ingredient`
WHERE `ingredient`.`ingredientId` IN(4,178) or `ingredient`.`linkIngredientPerent` IN(4,178)
)
ORDER BY `recipeId` ASC
Remove GROUP_CONCAT
from the subquery:
SELECT
GROUP_CONCAT(`recipe_ingredient`.`recipeId`)
FROM
`recipe_ingredient`
WHERE
`recipe_ingredient`.`ingredientId` IN (SELECT `ingredient`.`ingredientId` AS unlinkIng
FROM `ingredient`
WHERE `ingredient`.`ingredientId` IN (4, 178)
OR `ingredient`.`linkIngredientPerent` IN (4, 178))
ORDER BY
`recipeId` ASC
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments