|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I have an odd problem, when ever I do a select on my table like this: SELECT * FROM table_name WHERE LCASE(skills) LIKE "%string1%" OR "%string2%"; MySQL will return a row only matching "string1" and then stop. Is there a way to make it continue after it finds a match? I've looked in the mysql documentation. I'm using MySQL version 3.22.34 on win98 and FreeBSD. Any help would much aperciated. |
|
#2
|
|||
|
|||
|
I don't think that you can imply that the value after the OR should be applied to the previous condition LIKE
try SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LIKE '%string2%'; |
|
#3
|
|||
|
|||
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by RyanP:
I don't think that you can imply that the value after the OR should be applied to the previous condition LIKE try SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LIKE '%string2%';[/quote] Thanks for the quick reply.. but that gave a syntax error at the second LIKE.. |
|
#4
|
|||
|
|||
|
You SQL should be:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> SELECT * FROM table_name WHERE LCASE(skills) LIKE '%string1%' OR LCASE(skills) LIKE '%string2%'; [/code] Note the use of single quotes -- standard SQL defines the single quote character to delimit a string, not the double quote. MySQL may accept both, but other DBs are likely to be less forgiving. |
|
#5
|
|||
|
|||
|
oops!
thanks for the save chris |
|
#6
|
|||
|
|||
|
Yes, thanks for the help Chris. That worked perfectlly.
|
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > MySQL Selects |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|