Timeline for Finding gaps between the values of a column in MySQL
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 10, 2022 at 16:28 | history | edited | Rick James | CC BY-SA 4.0 |
added 52 characters in body
|
Apr 10, 2022 at 16:26 | comment | added | Rick James |
The pseudo-table provides all numbers in a desired range; after that, the LEFT JOIN and WHERE control what use you make of the "complete" set of numbers. If you wanted only 10 years starting with 1985, either use seq_1985_to_1994 or use, say, seq_0_to_9999 together with WHERE num BETWEEN 1985 AND 1994 .
|
|
Apr 10, 2022 at 16:22 | comment | added | Googlebot | if I'm not mistaken, it will catch any gap in the sequence, not a specific gap, e.g., X year (I mentioned 10 years in the example). | |
Apr 10, 2022 at 16:02 | history | answered | Rick James | CC BY-SA 4.0 |