【leetcode刷題】mysql題庫


IFNULL(exp1, exp2)

如果存在exp1則展示exp1,如果沒有輸出exp2

cast

convert 

 

# Write your MySQL query statement below
select DISTINCT
Num as ConsecutiveNums
from
(
select
Num,
( CASE WHEN Num = @curNum THEN @counter := @counter + 1 WHEN @curNum :=Num THEN @counter := 1 END ) as counter
from
Logs,
( select @curNum := NULL, @counter := 0 ) as q
) as a
where
counter >= 3

 

https://www.cnblogs.com/dannylinux/articles/8288790.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM