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
Sascha DeinertSascha Deinert 

SOQL Left()

Hi,

I get the following error:

Compile Error: unexpected token: ','
public Integer getNoOfEZR() { Integer NoOfEZR = [SELECT Count() FROM Einzelrisiko__c WHERE Left(Versicherungsscheinnummer__c,7) = 5758199]; return NoOfEZR; }
Where is my mistake?

Thank you,
Sascha

Best Answer chosen by Sascha Deinert
Vinit_KumarVinit_Kumar
Assuming that Versicherungsscheinnummer__c is a Text field.

Change your query from 

Integer NoOfEZR = [SELECT Count() FROM Einzelrisiko__c WHERE Versicherungsscheinnummer__c Like '5758199%']; return NoOfEZR; }

to

Integer NoOfEZR = [SELECT Count() FROM Einzelrisiko__c WHERE Versicherungsscheinnummer__c Like '5758199%']; return NoOfEZR; }

If this helps,please mark it as best answer to help others :)