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

SOQL Query to get records from the lead object

I am very new to Apex Development. I am trying to accomplish this: 


I have 1 custom object: ScoringRule__c and its fields are leadName__c, operator1__c, operator2__c, val1__c, val2__c, score__c

leadName__c stores the field name of the lead (Annual Revenue/No.OfEmployees etc.)

operator1__c and operator2__c stores the operater (greater than, less than etc.)

Va1_c and Val2_c store the values (any number).

In english, it would appear like this:

If the Annual revenue is greater than 0 and less than 100, give it a score of A.


I want to write a query that takes the lead object and gives me all leads that will have revenue between 0 to 100. 


Can i do that? Can anyone please help me out?


Are you looking for this..........


Select AnnualRevenue From Lead where AnnualRevenue>0 and AnnualRevenue<100


Hi Srini,


Thanks. I already found the solution to it.