You need to sign in to do that
Don't have an account?
Stephen E 4
What is wrong with this SOQL Query?
Hello!
I am trying to write some SOQL so that I can perform some bulk operations on opportunties. However, whenever I run this SOQL I get an error: "unexpected token: AND"
Here is the SOQL:
Here is the System.debug output:
I am just unsure what is wrong with this SOQL, seems I am escpaing the single quotes correctly...
Thank you!
I am trying to write some SOQL so that I can perform some bulk operations on opportunties. However, whenever I run this SOQL I get an error: "unexpected token: AND"
Here is the SOQL:
String query2 = 'SELECT Id FROM Opportunity WHERE NOT StageName LIKE \'%'+'closed'+'%\' AND division__c = \'IT Solutions\'';
Here is the System.debug output:
SELECT Id FROM Opportunity WHERE NOT StageName LIKE '%closed%' AND division__c = 'IT Solutions'
I am just unsure what is wrong with this SOQL, seems I am escpaing the single quotes correctly...
Thank you!
Can you please try below code . Please Mark it as BEST ANSWER if it helps you .
All Answers
Can you please try below code . Please Mark it as BEST ANSWER if it helps you .
Try this one
SELECT Id FROM Opportunity WHERE division__c = \'IT Solutions\' AND (NOT StageName like \'closed\' )