0

I can find sequenced record gaps where sequenced weeks with same numbers using following query.

SELECT * FROM pointed_numbers A WHERE EXISTS ( SELECT * FROM pointed_numbers B WHERE A.number = B.number AND (A.week = B.week + 1 XOR A.week = B.week - 1) ) ORDER BY A.number, A.week; 

How can I identify each gaps without stored procedure. I have tried with user-defined variable but I had no success.

1 Answer 1

1

Take a look at http://www.artfulsoftware.com/infotree/queries.php and look at the stuff under the "sequences" section. This is a super super helpful site with recipes for how to do complicated things in mysql!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.