MySQL Forums
Forum List  »  Newbie

How to get column/field names with select
Posted by: dump3
Date: August 10, 2005 01:32PM

This may be a stupid question -- but I can't find the answer. If I have a large select looking for matching information across MANY columns, is there a way I can display WHICH field or column names the query did or did not match on?

At least as I understand it, I get all the rows -- but not the column/field name which matched.

For example:

SELECT * FROM mytable
WHERE field1 LIKE '%value%' || field2 LIKE '%value%' || field3 LIKE '%value%' ...


There may be 10 or 15 fields. When I display the results with a link to the information -- I want to be able to include something that indicates the match was found in "field 9" or "field 3" -- so the folks know where to look.

Does that make sense?

Options: ReplyQuote


Subject
Written By
Posted
How to get column/field names with select
August 10, 2005 01:32PM


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.