Hot Accounts with Their Contacts
HardSOQL 50 ptsCreated Oct 2, 2026 Return every Account with Rating = 'Hot', together with the last names of its Contacts, in a single query.
Select Name and a parent-to-child subquery on the Contacts relationship returning LastName (sorted by LastName). Sort accounts by Name.
Accounts with no contacts must still be returned — their Contacts value is null.
Constraints
- One query, using a relationship subquery
(SELECT ... FROM Contacts ...).
- Row order is checked (accounts and contacts).
RelationshipsParent-to-ChildSubquery