/ Published in: SQL
                    
                                        
http://postgresql.nabble.com/Simple-way-to-get-missing-number-tp5662154p5662212.html
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
SELECT generate_series(
(SELECT MIN(id) FROM locations),
(SELECT MAX(id) FROM locations)
) AS genid
EXCEPT SELECT id FROM locations
ORDER BY genid ASC;
Comments
 Subscribe to comments
                    Subscribe to comments
                
                