180. 连续出现的数字 # Write your MySQL query statement below select distinct(aa.num) as ConsecutiveNums from Logs aa,Logs bb,Logs cc where aa.num=bb.num and bb.num=cc.num and aa.id=bb.id-1 and bb.id=cc.id-1 这道题是要找到连续的3个相同值,不是简单的统计重复值的个数,所以可以使用三表连接的思路。 另外判断是否是连续的三个值,可以使用a=b且b=c的写法。