I have the following query to get my next available number from the table:
SELECT MIN(INT(A.CODE) + 1)
FROM TABLE_CODE A
WHERE INT(A.CODE) NOT IN (
SELECT INT(B.CODE) -1
FROM TABLE_CODE B
WHERE INT(B.CODE) = (INT(A.CODE) + 1))
It take about 15 sec to execute it.
Is there any way to increase the performance of that query?
Thank's
SELECT MIN(INT(A.CODE) + 1)
FROM TABLE_CODE A
WHERE INT(A.CODE) NOT IN (
SELECT INT(B.CODE) -1
FROM TABLE_CODE B
WHERE INT(B.CODE) = (INT(A.CODE) + 1))
It take about 15 sec to execute it.
Is there any way to increase the performance of that query?
Thank's