function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manas.demanas.de 

Not like in SOQL

Hi,
 
Is there a not like clause in SOQL.
 
Can we write a query like
Select id, firstname from contact where firstname not like 'manas%'
 
Thanks in advance.
SuperfellSuperfell
Select id, firstname from contact where not firstname like 'manas%'
 
SaaniaSaania
Hi,

Can the NOT LIKE not work with an AND. I get an error when i execute something like ....

Code:
"Select Name,Id from User where not Name like 'SA%' AND name like 'K%'"

 
the error says 'Unexpected token AND' : Malformed Query !!.

Would appreciate any help.

Thanks,
Saania
SuperfellSuperfell
You need to add some (), so that it know's which part you're trying to not/and, e.g.
Select Name,Id from User where (not Name like 'SA%') AND (name like 'K%')