bcamp1973 Posted August 21, 2006 Share Posted August 21, 2006 when i do the following SELECT statement it's possible for the recipe to be returned multiple times if an ingredient applies more than once...such as a search on "garlic" that may return on "garlic", "garlic cloves", "garlic salt" etc. How can i limit the select so it only returns one instance of the recipe even on multiple ingredient matches?[code]SELECT recipes.name, recipes.descriptionFROM recipes, recipe_ingredientsWHERE recipe_ingredients.recipe_id=recipes.idAND MATCH(ingredient) AGAINST ("'.strtolower($_GET['ingredient']).'" IN BOOLEAN MODE)ORDER BY name ASC[/code] Quote Link to comment https://forums.phpfreaks.com/topic/18241-solved-ignoring-non-unique-results-on-select-statements/ Share on other sites More sharing options...
fenway Posted August 21, 2006 Share Posted August 21, 2006 Add a "GROUP BY recipes.id" Quote Link to comment https://forums.phpfreaks.com/topic/18241-solved-ignoring-non-unique-results-on-select-statements/#findComment-78342 Share on other sites More sharing options...
bcamp1973 Posted August 21, 2006 Author Share Posted August 21, 2006 awesome! thank you...i didn't even think to look at the GROUP BY function as I was making my way through the function list. Cheers! Quote Link to comment https://forums.phpfreaks.com/topic/18241-solved-ignoring-non-unique-results-on-select-statements/#findComment-78345 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.