-
SQL Query for detecting break in sequence
I have a column,which does not have any constraint on it.It has a set of sequential values,say for eg1,2,3,4,5.....Now somewhere
in this column the sequence breaks,i.e. say 9 comes after 7 instead of 8.My question is how do I identify such rows where there is a break in sequence?SELECT DISTINCT ....ORDER BY is not possible as the record count is extremely large.Please Help.
-
Look into documentation for LEAD clause, this allows you to compare value in next row for a column. You can check difference in values between two rows, if it is more than 1 you have a break.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|