diff --git a/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README.md b/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README.md index 52a20d1a05b30..594698c4ce26e 100644 --- a/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README.md +++ b/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README.md @@ -92,4 +92,15 @@ FROM Orders AS o WHERE order_type = 0 OR NOT EXISTS (SELECT 1 FROM T AS t WHERE t.customer_id = o.customer_id); ``` +```sql +SELECT DISTINCT + a.order_id, + a.customer_id, + a.order_type +FROM + Orders AS a + LEFT JOIN Orders AS b ON a.customer_id = b.customer_id AND a.order_type != b.order_type +WHERE b.order_type IS NULL OR b.order_type = 1; +``` + diff --git a/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README_EN.md b/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README_EN.md index 733995ebfe32b..5afadad98d138 100644 --- a/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README_EN.md +++ b/solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README_EN.md @@ -88,4 +88,15 @@ FROM Orders AS o WHERE order_type = 0 OR NOT EXISTS (SELECT 1 FROM T AS t WHERE t.customer_id = o.customer_id); ``` +```sql +SELECT DISTINCT + a.order_id, + a.customer_id, + a.order_type +FROM + Orders AS a + LEFT JOIN Orders AS b ON a.customer_id = b.customer_id AND a.order_type != b.order_type +WHERE b.order_type IS NULL OR b.order_type = 1; +``` +