Re: Find Missing Numbers in a Sequence

Tech-Archive recommends: Fix windows errors by optimizing your registry



The missing numbers have to come from somewhere, to create a table that has the entire sequence of numbers you could need, from lowest to highest. You can use the code at the end of this page to populate it if you wish:
http://allenbrowne.com/ser-39.html
(The example populates from 1 to 1000, but you can change the loop easily enough.)

Now use the Unmatched Query Wizard to get all the numbers in this counter table that are not in your actual table.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Gary Dolliver" <GaryDolliver@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BCA23BD4-4D7D-4932-AB35-9BAAB417111D@xxxxxxxxxxxxxxxx
Hi everyone,
I have a table that is imported to daily, and sometimes orders are not
correctly migrated into the system. As all numbers that come in are in
numerical order, is there a way to create a query that will return a result
set of numbers from the sequence that are missing, based on the highest and
lowest value of the number sequence?
Help is always appreciated, thanks!
-gary

.



Relevant Pages

  • Re: Programmers unpaid overtime.
    ... "A polynomial is a mathematical expression involving ... And if terms are missing, or the exponents are out of sequence, the ... You all think I'm paranoid, ...
    (comp.programming)
  • Re: puzzle
    ... Determine the xor of the numbers 0...n, ... >) sequence. ... Determine the sum of the numbers 0...n, ... The difference of the two sums is the missing number. ...
    (comp.programming)
  • Re: Query to find amissing number
    ... Here I need to write a query to find out that number 7 is missing in the ... given sequence. ... giving you a quick way to determine if any gaps exist. ...
    (comp.databases.sybase)
  • Re: Find Missing Numbers in a Sequence
    ... This will list the start of the gap. ... The simplest solution to catch every item that is missing would be ... to use an auxiliary table that contains nothing but a sequence of numbers ... numerical order, is there a way to create a query that will return a ...
    (microsoft.public.access.queries)
  • Re: puzzle
    ... Determine the xor of the numbers 0...n, ... sequence. ... Determine the sum of the numbers 0...n, ... The difference of the two sums is the missing number. ...
    (comp.programming)