https://leetcode.com/problems/consecutive-numbers


Success

___


> We can select table multiple times and do the operation, which is amazing!

___


```mysql
# 2022.12.28 05:20

/*
SELECT * FROM
(
    SELECT
        Logs.num AS ConsecutiveNums
    FROM Logs
    GROUP BY Logs.num
    HAVING
        COUNT(Logs.num) > 2
) new_table
;
*/

SELECT DISTINCT logs_1.num AS ConsecutiveNums
FROM Logs logs_1, Logs logs_2, Logs logs_3
WHERE logs_1.num = logs_2.num AND logs_2.num = logs_3.num AND logs_3.id = logs_2.id+1 AND logs_2.id = logs_1.id+1
;

# 2022.12.28 05:56
```
