Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I select an element that doesn't exists in a table?
jose_luis_fdez_diaz schrieb:
> In the table below:
>
> table1
> ---------
> 1
> 2
> 4
> 5
>
>
> select 3 from table1 where not exists (select * from table1 where
> row1!=3)
>
> returns:
>
> 3
> 3
> 3
> 3
>
> I only want "one" 3.
>
> How can I get it?
>
> PD: Sorry for my little explanation in the last post.
>
>
> Regards,
> Jose Luis.
>
> Laurenz Albe wrote:
>> jose_luis_fdez_diaz <gfiuni2_at_gmail.com> wrote: >>> Idem. >> 'Idem' is Latin for 'the same'. >> >> What do you want to tell us? >> Or, more to the point, what is your question? >> >> If it is the question in the subject, please clarify what you want. >> >> Are you looking for 'SELECT 42 FROM dual' ? >> >> Yours, >> Laurenz Albe
Your query would return no rows (not 4 rows with '3'). Still it is unclear, what you try to achieve. Do you have a sequential values in your table and like find the "gaps" in this sequence ? If yes, are the start and end values defined ( i.e. , if the gap occur at the highest end of your sequence, do you consider this to be a gap or not) ?
Best regards
Maxim Received on Mon Nov 13 2006 - 08:42:39 CST