ForceChallenges
ProblemsDailyNotes
Sign in
Problem list
Sign in to submit

Accounts Spanning Three or More Stages

HardSOQL 50 ptsCreated Oct 9, 2026

Solve the business requirement using SOQL and return the requested meaningful results.

Constraints

Use the specified SOQL features and preserve required filters and ordering.

COUNT_DISTINCTHAVINGGROUP BY
CodeSOQL
Loading editor…
+3 hidden on submit
visible

Seed data

Account× 7 rows
Name: Account {{i}}
Opportunity× 28 rows
Name: Deal {{i}}Amount: {{i*100000}}AccountId: {{id:Account:i%7+1}}CloseDate: {{date:-i}}StageName: {{pick:Prospecting|Proposal|Negotiation/Review|Closed Won}}

Expected

7 row(s), order checked

#totalstagesAccountId
170000004001000000000001AAA
266000004001000000000007AAA
362000004001000000000006AAA
458000004001000000000005AAA
554000004001000000000004AAA
650000004001000000000003AAA
746000004001000000000002AAA