Jump to content

"OR" im trying to find a field which has a or b or c in it


mojito

Recommended Posts

Im trying to look in a single field for theoccurance of one of three strings..looking at an operator page on mysql.com i see that to get [b]or[/b] you just use a space so
[code]
....WHERE virtualName='stringone stringtwo stringthree'
[/code]

I would like to get a hit if the field contains either "stringone" or "stringtwo" or "stringthree"

thanks for any help.

mojito
Actually, IMHO, an IN clause is "easier":

[code]WHERE virtualName IN ( 'stringone', 'stringtwo', 'stringthree' )[/code]

Not to mention that it makes the conversion from an array trivial... plus I'm sure the optimizer has less work to do.
[!--quoteo(post=387154:date=Jun 23 2006, 09:37 AM:name=cmgmyr)--][div class=\'quotetop\']QUOTE(cmgmyr @ Jun 23 2006, 09:37 AM) [snapback]387154[/snapback][/div][div class=\'quotemain\'][!--quotec--]
O cool...didn't know you could do that.
What do you know...you learn something new every day!
[/quote]
I wish that was actually true.... [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.