hard20 pts · first answer countssqljoins
LEFT JOIN that acts like INNER JOIN
You want all customers with their 2026 orders, including customers with none. This query drops customers with no orders: SELECT c.id, o.id FROM customers c LEFT JOIN orders o ON o.customer_id = c.id WHERE o.year = 2026. Why?
Discussion 0
Join free to post in the discussion.
Related questions
- Counting orders per customerData Scientist
- Customers with no ordersData Scientist
- Filtering groups in SQLData Scientist
- COUNT of a column with NULLsData Scientist
- Latest order per customerData Scientist
- Row count after a mergeData Scientist
- Ranking with ties in SQLData Scientist
- NOT IN returns no rowsData Scientist