Missing in sequence query

D

Daniel P

I have a table with a serie of sequential number that are entered by the user. The sequence is limited between 1000 and 250

How can I query to see if there are gave in the numberin

ie
100
100
100

the query would flag 1002 as missing.
 
J

John Viescas

This won't list all the missing numbers, but it will display the start of
each gap:

SELECT MyTable.Number +1 AS Missing
FROM MyTable LEFT JOIN MyTable As T2 ON MyTable.Number = (T2.Number + 1)
WHERE T2.Number IS NULL

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
Daniel P said:
I have a table with a serie of sequential number that are entered by the
user. The sequence is limited between 1000 and 2500
 
Top