I've been staring at the following query for a day. I'm sure it's
something obvious but I just don't see it.

        There are two table, Recipes which contains one row per
recipe. The second in Ingredients while holds one row per
ingredient. The Ingredients table has a field containing the
parent recipe ID. I want to perform a query on the Ingredients
Description field and return from the Recipes table distinct
parent ID, Category Code, and Title. Here is my query:

SELECT DISTINCT R.ID, R.CatCode, R.Title
   FROM Recipes R, Ingredients I
   WHERE I.Description LIKE "%$SearchKey%"

If the LIKE clause produces any match, all Recipe rows are returned.
If there are no matches, zero rows are returned. To wit. if
$SearchKey = "e" all rows in Recipes are returned as they should.
If $SearchKey = "rice" all rows in Recipes are returned but only one
should be returned.

        Any suggests would be appreciated.

Urb


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to