Click here to Skip to main content
12,827,807 members (45,487 online)
Click here to Skip to main content

Tagged as


Posted 13 Nov 2012

How to find a gap in the table between min and max value using pure SQL

, 14 Nov 2012 CPOL
While Shanalal Kasims solution is cool, it doesn't work when you have a larger gap in the sequence.This is pure SQL and should work for all cases:WITH M AS ( SELECT Max(SEQUENCE) s FROM table1 WHERE id = 1 ),numbers(n) AS ( SELECT 1 AS n UNION ALL...



Compare Revision Minor Date Status Editor
5 - publicly available No 14-Nov-12 2:25 Available Jörgen Andersson
Updates in content. 8 changes had been made.
3 No 14-Nov-12 2:12 Available Jörgen Andersson
Updates in content. 93 changes had been made.
2 No 14-Nov-12 1:04 Available Jörgen Andersson
Forgot Parenthesis
1 No 13-Nov-12 23:35 Available Jörgen Andersson


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Jörgen Andersson
Database Developer
Sweden Sweden
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170326.1 | Last Updated 14 Nov 2012
Article Copyright 2012 by Jörgen Andersson
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid