# Write a SOQL query to find the 2nd Highest Amount among all Opportunities (ORDER BY Amount DESC NULLS LAST LIMIT 1 OFFSET 1).

**Topic:** Development · **Difficulty:** Medium · **Asked at:** TCS, Cognizant, Wipro, HCL · **Tags:** soql, scenario, offset

Read it on the site: https://www.forcechallenges.com/interview-questions/write-a-soql-query-to-find-the-2nd-highest-amount-among-all-opportunities-order-by-amount-desc-nulls-last

## Answer

Sort descending, skip the first row, and take one.

```soql
SELECT Id, Name, Amount FROM Opportunity
WHERE Amount != null
ORDER BY Amount DESC NULLS LAST
LIMIT 1 OFFSET 1
```
This returns the record with the 2nd highest Amount (ties return the next row, not the next distinct value; for distinct values group by Amount).

---
Source: ForceChallenges · last updated 2026-10-19
