File tree Expand file tree Collapse file tree 2 files changed +36
-2
lines changed
solution/0100-0199/0180.Consecutive Numbers Expand file tree Collapse file tree 2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -60,10 +60,27 @@ Result 表:
60
60
61
61
### ** SQL**
62
62
63
- ```
63
+ ``` sql
64
64
select distinct (Num) as ConsecutiveNums from Logs Curr where
65
65
Num = (select Num from Logs where id = Curr .id - 1 ) and
66
66
Num = (select Num from Logs where id = Curr .id - 2 )
67
67
```
68
68
69
+ ``` sql
70
+ # Write your MySQL query statement below
71
+ SELECT DISTINCT l1 .num AS ConsecutiveNums
72
+ FROM
73
+ logs AS l1,
74
+ logs AS l2,
75
+ logs AS l3
76
+ WHERE
77
+ l1 .id = l2 .id - 1
78
+ AND
79
+ l2 .id = l3 .id - 1
80
+ AND
81
+ l1 .num = l2 .num
82
+ AND
83
+ l2 .num = l3 .num
84
+ ```
85
+
69
86
<!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -56,10 +56,27 @@ Logs table:
56
56
57
57
### ** SQL**
58
58
59
- ```
59
+ ``` sql
60
60
select distinct (Num) as ConsecutiveNums from Logs Curr where
61
61
Num = (select Num from Logs where id = Curr .id - 1 ) and
62
62
Num = (select Num from Logs where id = Curr .id - 2 )
63
63
```
64
64
65
+ ``` sql
66
+ # Write your MySQL query statement below
67
+ SELECT DISTINCT l1 .num AS ConsecutiveNums
68
+ FROM
69
+ logs AS l1,
70
+ logs AS l2,
71
+ logs AS l3
72
+ WHERE
73
+ l1 .id = l2 .id - 1
74
+ AND
75
+ l2 .id = l3 .id - 1
76
+ AND
77
+ l1 .num = l2 .num
78
+ AND
79
+ l2 .num = l3 .num
80
+ ```
81
+
65
82
<!-- tabs:end -->
You can’t perform that action at this time.
0 commit comments