Skip to content
Advertisement

Tag: case-when

CASE clause in WHERE

I’m doing a leetcode question. 2 similar answers are worked out. But I have no idea why one is wrong and the other is right. The following is the question link. The goal is writing a SQL query to find all numbers that appear at least three times consecutively. https://leetcode.com/problems/consecutive-numbers/ The table looks like Right version: The output: Wrong version:

Advertisement