In a script I'm running I need to query against a field that is a
string, but I only want to use a substring as the query condition.
This is an example of the string that I'm searching against:
Classic Perm, Curly Hair, Medical, Medium to Short, Monofilament Top,
Short Length, Synthetic Hair, Wavy Hair,
I want to use this substring as the condition: "Short Length".
I want to avoid the other occurance of "Short" as in "Medium to
Short".
There are thousands of strings like this so I have to make the query
generic.
Is this possible?
Thank you,
- D
MySQL REGEXP Help
Moderator: General Moderators
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
You mean you have names but you want to use a shorter name for the ease of use? Sorry, I didn't really understand it but if you're trying to do what I stated above then it might be an idea to have an array of short names and long names and process through that when excuting the query.
Hope that helped,
-Nay
Hope that helped,
-Nay
-
Cruzado_Mainfrm
- Forum Contributor
- Posts: 346
- Joined: Sun Jun 15, 2003 11:22 pm
- Location: Miami, FL
try:
Code: Select all
SELECT * FROM `table` WHERE field1 LIKE '%Short Length%'