On Fri, 22 Aug 2003 23:28:18 +0000 "Nathan Simms" <[EMAIL PROTECTED]> wrote:
> Hi, I'm currently using the following mysql statement to perform a search. > Right now it is only returning the results which are found in the > description field. How do I modify this statement so that it is searching > the following fields: company_name, product_name, description. > > SELECT product_id, company_name, product_name, url, description > FROM product, company > WHERE product.product_id = company.company_id AND description regexp > '#FORM.query#' try this one: SELECT product_id, company_name, product_name, url, description FROM product, company WHERE product.product_id = company.company_id AND description LIKE '%FORM.query%' AND company_name LIKE '%FORM.query%' AND product_name LIKE '%FORM.query%'; of course, you should use LIKE only when you're seeking for partial match. in other cases use "....company_name='Bla'....." and don't forget about indexes. --- WBR, Antony Dovgal aka tony2001 [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]