+ Start a Discussion
Deepu sfdcDeepu sfdc 

How to get alternate records in single SOQL query

Hi,

I have 100 records i want to display records from 30 to 40 and 70 to 78 in single SOQL query ..
How it is possible ?

Thanks in advance.
SFDC Prime SquadSFDC Prime Squad
You can use offset here. For example : SELECT Name FROM Merchandise__c WHERE Price__c > 5.0 ORDER BY Name LIMIT 100 OFFSET 10
Check this out : https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm