2
Problem
In a table X and I own N records, but these records are not sequential (throughout Insert, Id will always be larger than the previous one, but not necessarily the next number).
I need to know which id’s I don’t have in the bank.
Example
SELECT Id FROM X
Would return
Id
1
2
4
8
12
I need to return the Ids 3,5,6,7,9,10,11
that are missing.
I searched a lot, but only found results in English and these results unfortunately did not solve the problem.
Question
How to create a query that can solve this in just a column and without the creation of other tables ?
I have been informed that I cannot create tables due to the ORM.
– LP. Gonçalves
can’t do it via code? load the ones that exist in the base and see what has not been returned?
– rLinhares
The intention to do via query, was to avoid a development of an application that would be unnecessary.
– LP. Gonçalves