+ Start a Discussion
AlsoDougAlsoDoug 

SOQL Equivalent To WHERE 1=1

Sorry newbie with what is probably a newbie question.

 

When I am writing what I gather is defined as "dynamic" SOQL is there an equivalent to SQL 1=1.

 

I won't claim or defend that this is even best practice in SQL but it is convenient.

 

Thanks

Doug

 

kevingwynnkevingwynn
I haven't found one I like, and it makes me sad. Left side of an expression seems to have to be a field name or a limited set of functions and the right side CANNOT be a field name, so     Id = Id    is out as well. You could go with something like  
Id != null
or    
CreatedDate <= Today
 Otherwise, it looks like a few extra if statements are necessary.