Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Looking to write a query to give me the missing numbers in a sequence

$
0
0

My query here gives me a list of numbers:

 select distinct cast(SUBSTRING(docket,7,999) as INT) from [DHI_IL_Stage].[dbo].[Violation] where InsertDataSourceID='40'
  and ViolationCounty='Carroll' and SUBSTRING(docket,5,2)='TR' and LEFT(docket,4)='2011'
  order by 1

Gives back:

I want to find the numbers missing in the sequence


Viewing all articles
Browse latest Browse all 23857

Trending Articles