I have this table
ID | Seq
------------
A 1
A 2
A 3
B 1
B 2
B 3
B 3 <--duplicate seq where ID=B
C 1
C 2
C 4 <--missing seq id number 3
D 1
D 2
. .
. .
Is there a way to detect if/when there is an error in the logic of the Seq column, specifically if there are jumps and/or duplicates.
try this:
this should work both in sql server as well as Oracle
SQL fiddle demo for SQL server
SQL Fiddle demo for Oracle