MySQL Forums
Forum List  »  Newbie

Searching withing a single field using wildcards.
Posted by: Andy Lawrence
Date: May 13, 2005 11:53AM

I am new to MySQL and I need to write a select statement that will pull all rows that have a certain string in one of the fields. Basically I have a table of Loan Officers for a mortgage company and each loan officer has a field in his record that is two digit state codes seperated by commas (i.e. MI,CA,MN) used to identify what states they are licensed to work in. I need to pull back just the loan officers that are licenced in a certain state. Here is the statement I am currently using:

SELECT * FROM loinfo WHERE License LIKE '%MI%';

The Problem with this is that LIKE seems to use too loose of a rule set because this statement also pulls back anyone licensed in a state that has an M or an I in it.

Could someone please help me figure out how to get only exact matches back.

Thanks

Options: ReplyQuote


Subject
Written By
Posted
Searching withing a single field using wildcards.
May 13, 2005 11:53AM


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.