# Accounts With Only Lost Deals

**Type:** SOQL · **Difficulty:** Hard · **Topics:** Semi-Join, Anti-Join, Closed Lost

Practice this problem interactively (write and run your SOQL against realistic data): https://www.forcechallenges.com/problems/accounts-with-only-lost-deals

## Problem

**Scenario**
The sales operations team is reviewing customers who never turned into revenue. They want Accounts where the company has lost at least one deal and has never won any, so they can decide whether the relationship is worth pursuing again.

**Task**
Write one SOQL query on `Account` that returns Accounts which:
1. Have **at least one** Opportunity in the stage `Closed Lost`, and
2. Have **no** won Opportunity (`IsWon = true`).

Accounts with no Opportunities at all are not part of this list. Open Opportunities do not disqualify an Account.

**Expected output**
One row per matching Account with the columns `Id` and `Name`. Row order does not matter.

**Example**
- Acme has two Closed Lost Opportunities and nothing else. It is returned.
- Globex has one Closed Lost and one Closed Won Opportunity. It is excluded because it has a win.
- Initech has no Opportunities. It is excluded.

## Constraints

Use one query on Account that combines a semi-join (Id IN) for Closed Lost Opportunities with an anti-join (Id NOT IN) for won Opportunities. Test won deals with IsWon = true, and lost deals with StageName = 'Closed Lost'.

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