Skip to content

Commit c656e32

Browse files
authored
feat: add sql solution to lc problem: No.2084 (#1881)
1 parent 7f6cc7d commit c656e32

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,15 @@ FROM Orders AS o
9292
WHERE order_type = 0 OR NOT EXISTS (SELECT 1 FROM T AS t WHERE t.customer_id = o.customer_id);
9393
```
9494

95+
```sql
96+
SELECT DISTINCT
97+
a.order_id,
98+
a.customer_id,
99+
a.order_type
100+
FROM
101+
Orders AS a
102+
LEFT JOIN Orders AS b ON a.customer_id = b.customer_id AND a.order_type != b.order_type
103+
WHERE b.order_type IS NULL OR b.order_type = 1;
104+
```
105+
95106
<!-- tabs:end -->

solution/2000-2099/2084.Drop Type 1 Orders for Customers With Type 0 Orders/README_EN.md

+11
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,15 @@ FROM Orders AS o
8888
WHERE order_type = 0 OR NOT EXISTS (SELECT 1 FROM T AS t WHERE t.customer_id = o.customer_id);
8989
```
9090

91+
```sql
92+
SELECT DISTINCT
93+
a.order_id,
94+
a.customer_id,
95+
a.order_type
96+
FROM
97+
Orders AS a
98+
LEFT JOIN Orders AS b ON a.customer_id = b.customer_id AND a.order_type != b.order_type
99+
WHERE b.order_type IS NULL OR b.order_type = 1;
100+
```
101+
91102
<!-- tabs:end -->

0 commit comments

Comments
 (0)