Find out what numbers are not following designed sequence.

  • Example : If numbers range from 1 to 1957 and should be in sequence (1,2,3,4,5,6......1957), how can I find a number that does not
    follow the designed sequence (like 1,2,3,6,4,5,7,8,10,11,9..1957.). Numbers 6 and 9 are not in the right sequence.
    What would a query look like ?

    Numbers are entered in a column called 'location' and is of int type.

  • Senchi - Wednesday, July 26, 2017 6:20 PM

    Example : If numbers range from 1 to 1957 and should be in sequence (1,2,3,4,5,6......1957), how can I find a number that does not
    follow the designed sequence (like 1,2,3,6,4,5,7,8,10,11,9..1957.). Numbers 6 and 9 are not in the right sequence.
    What would a query look like ?

    Numbers are entered in a column called 'location' and is of int type.

    What is the logic for the sequence?
    Using 1,2,3,6,4,5,7,8,10,11,9..
    Why is 6 out of sequence?  Maybe it is 4 and 5 that are out of sequence?

  • How are you defining that these numbers are out of order as well? Is there another column we should be checking against that defines the order that your rows are returned? Otherwise this is a "simple" ordering problem, and using an ORDER BY clause makes it "go away".

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply