You need to sign in to do that
Don't have an account?

SQL to SOQL
How to write the below code in SOQL format?
SQL:-
SELECT ROW_NUMBER() OVER (ORDER BY EmployeeName) AS Row, EmployeeId, EmployeeName, Salary FROM Employees where Row BETWEEN 2 AND 4
The following SOQL query returns a result set that skips the first 100 rows of the full query results:
similarly, you can use something like:
---------------------------------------------
SELECT EmployeeId, EmployeeName, Salary
FROM Employees
ORDER BY EmployeeName
LIMIT 3
OFFSET 1
---------------------------------------------
Numbers mentioned in the SOQL in the LIMIT and OFFSET clause may vary depending on how BETWEEN operator is interpreted by the database. If the test values are included, then the SOQL will work for you. If test values are excluded, then you may nodify your SOQL to LIMIT 1 as only the record with ROW_NUMBER 3 will be returned in your SQL.
Hope this gives you a direction to proceed in.
All Answers
The following SOQL query returns a result set that skips the first 100 rows of the full query results:
similarly, you can use something like:
---------------------------------------------
SELECT EmployeeId, EmployeeName, Salary
FROM Employees
ORDER BY EmployeeName
LIMIT 3
OFFSET 1
---------------------------------------------
Numbers mentioned in the SOQL in the LIMIT and OFFSET clause may vary depending on how BETWEEN operator is interpreted by the database. If the test values are included, then the SOQL will work for you. If test values are excluded, then you may nodify your SOQL to LIMIT 1 as only the record with ROW_NUMBER 3 will be returned in your SQL.
Hope this gives you a direction to proceed in.