This question runs in a pre-configured Salesforce environment - no personal connection required.

Using SOQL aggregation, return the number of Accounts that are associated with more than one Opportunity. Group Opportunity records by their parent Account and count the Accounts that have more than one related Opportunity.

Examples:

Scenario: Three Accounts exist in the org. - Account A has 3 related Opportunities -> counted (more than one) - Account B has 1 related Opportunity -> excluded (not more than one) - Account C has 2 related Opportunities -> counted (more than one) Output: 2 Explanation: Two Accounts have more than one Opportunity. Scenario: All Accounts have exactly one Opportunity. Output: 0 Explanation: No Account qualifies because none has more than one Opportunity. Scenario: One Account has 5 Opportunities, all others have zero. Output: 1 Explanation: Only the Account with 5 Opportunities is counted.
Apex Code Editor

Welcome to Lightning Challenge!

How It Works

  • • Write your solution in the code editor
  • • This challenge runs without connecting your own org
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 #CodeEveryDay September 2026 (Sep 16–30)Sponsored by FLXBL

Contest runs September 16 - 30. Complete challenges to climb the leaderboard!

Prizes 1 & 2: Salesforce certification exam voucher — won by random drawing, where every point is a ticket. see all prizes

Only the 15 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In