Skip to content
Advertisement

Find Gaps in a single date column SQL Server

Good Day everyone,

I need your help.

I am trying to detect gaps in a single column of the type Date or DateTime in SQL Server.

Say we have a list of schools and each school has many records and there is a field of uploadDate.

So something like that:
enter image description here

My outcome would be something like that:
enter image description here

Thank you all.

Advertisement

Answer

You can use lead():

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement