> In a table I have records with id's 2,4,5,8. How can I receive a list with > values > 1,3,6,7. I have tried in this way > > SELECT t1.id + 1 > FROM table t1 > WHERE NOT EXISTS ( > SELECT * > FROM table t2 > WHERE t2.id = t1.id + 1 > ) > > but it's not working correctly. It doesn't bring all available positions.
The SQL looks OK and should work. What is the datatype of the ID column of the table? Sean