Customers Active in Both 2025 and 2026
Medium
Anti & Semi Joins
Return the customer_ids that placed at least one order in 2025 and at least one order in 2026. Order by customer_id.
Table schema
Orders(id INT PRIMARY KEY, customer_id INT, order_date DATE)Sample data
id | customer_id | order_date
1 | 1 | 2025-06-01
2 | 1 | 2026-01-10
3 | 2 | 2025-03-03
4 | 3 | 2026-02-02
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.