I have the following table:
And I am looking for an output like this with a consecutive available two slots. Preferably the consecutive number should be a variable like @n = 2.
How to achieve this in TSQL? Thanks!
Update 8/3/2022:
I undeleted this question as it is not fair to @lptr, as he/she has the correct solution, but didn't put that in answer section.
Sean Lange: Sorry, my question was not very clear for the first time, but basically the query is looking at the SLOT column with Available=Y data, and need to output the first occurrence of the row where SLOT numbers are "N" consecutive numbers, in this case 2.