Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • it doesn't work ... what is the exact error message you are getting? Your query is missing a WHERE clause, but maybe this is just a copying error. Commented Jun 25, 2021 at 6:13
  • please show your actual query and explain what you mean by "it doesn't work"; what does happen? please also edit your question to show output (as text, not an image) of show create table DAYSWORKED and some insert statements for sample data and desired and actual results for that sample data that demonstrate the problem Commented Jun 25, 2021 at 6:13
  • 1
    GAP column contains window function which is not allowed in HAVING clause, even implicitly. Because it affects the output rowset and hence it affects window function (self) result which is obtained between HAVING and ORDER BY. Commented Jun 25, 2021 at 6:31