+ Start a Discussion

Noob SOQL question.

I've been searching around the internetz, but I haven't found a definitive answer. 


I'm trying to write a search method that filters based on Record Type. (I'm only searching one object, hence no SOSL)


It returns anything that contains the search string itself, so I'm using like so far.  I want to know a few things:


Does SOQL have support for Contains, (or anything to that effect)? 


Does Like check strings themselves?  For example, if I type 'Hello World' in the search string, will it return things only with the phrase 'Hello World' or will it return results on 'Hello' and 'World' seperately? 


You can character that one could liken to regular expressions. '_' and '%'


I believe '_' means one of any character and '%' means one or more of any character.


I can't find the documentation in the online reference, but I've seen it there, under the SOQL < WHERE clause section, but, here is some examples of it:



I think it follows SQL in this manner:




I believe that % means 0 or more of any character, so if you have some soql like:


select Name from Account where name LIKE '%YMCA%'


this will find any account where YMCA appears anywhere in the name - middle, start, end.