Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL question
Great solution, great idea. But, it doesn't return 1 when we have values
like 2,3,5,6...
This is complete script:
SELECT decode(MIN ( a.col1)
,1,MIN ( a.col1 + 1 ),1)
SELECT 1 FROM junk b WHERE b.col1 = ( a.col1 + 1) )
Terje Tysse wrote:
> What about :
>
> SELECT MIN ( a.nr + 1 )
> FROM data a
> WHERE NOT EXISTS (
> SELECT 1
> FROM data b
> WHERE b.nr = ( a.nr + 1) ) ;
Received on Tue Dec 29 1998 - 21:37:45 CST