You need to sign in to do that
Don't have an account?
Ramesh A 8
Unable to get the second highest value.
Hello,
I am trying to get the second highest value in SOQL with below Query,
I am trying to get the second highest value in SOQL with below Query,
select Max(Age__C) from Patient__c Where Age__C NOT IN ( select MAX(Age__c) from Patient__c )But am getting result with below Query
select Max(Age__C) from Patient__c Where Age__C NOT IN (23)
Try below Aggregate Queries:
- thatherahere
You can try something like this if your Age__c field is of type number:
List<Patient__c> lstPatient = [select Age__c from Patient__c order by Age__c DESC limit 2];
system.debug('============'+lstPatient[1].Age__c);