MySQL Forums
Forum List  »  Newbie

Simple question about referencing more than one field in a table for a single query
Posted by: Claire Thompson
Date: September 09, 2008 03:41PM

Hey there

New to the forum - thanks for the patience.

I am working with a database that uses seven (count 'em) different description fields for a product and I'd like to create a search function that will look in all seven for the the search term. I have it working if I specify a single field, but I don't know how to change the query to make it look in multiple fields.

Example:

$result = mysql_query("SELECT *
FROM `tblFamily`
WHERE
`FAMILY_DESC_5`
LIKE CONVERT( _utf8 '%ireland%'
USING latin1 )
COLLATE latin1_swedish_ci");

works great.

How do I also get it to look in the field FAMILY_DESC_4 and FAMILY_DESC_3, etc., for the search term ireland?

I inherited all of this so advice to change the database to something more sensible and store all of the same kinds of reference in the same field will be met with sympathy but no luck!

Thanks in advance.

Claire

Doh! PHP and MySQL are the tools!

Options: ReplyQuote


Subject
Written By
Posted
Simple question about referencing more than one field in a table for a single query
September 09, 2008 03:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.