Let's take an example. These are the rows of the table I want get the data:
The column I'm talking about is the reference
one. The user can set this value on the web form, but the system I'm developing must suggest the lowest reference
value still not used.
As you can see, the smallest value of this column is 35. I could just take the smaller reference and sum 1, but, in that case, the value 36 is already used. So, the value I want is 37.
Is there a way to do this without a loop verification? This table will grow so much.