Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Missing Numbers Query?

Author  Topic 

jimithing1980
Starting Member

3 Posts

Posted - 2004-10-06 : 17:13:10
I've been trying to figure out how to create a query that would list the missing numbers between a high and low number for a field. For example, If I have the recordset below:

1
3
4
6
7
9

I'd like the resulting recordset to be:

2
5
8

Is there a way to achieve this? Thanks, Jason.

VIG
Yak Posting Veteran

86 Posts

Posted - 2004-10-06 : 18:12:50
[url]http://www.nigelrivett.net/FindGapsInSequence.html[/url]
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-10-07 : 09:03:36
Use a tally table here.
Go to Top of Page
   

- Advertisement -