SQL question
Posted in 1993
Julie Jumes — — source: Informix-list mailing list archive (1991-1998)
I am looking for the smallest value in a table of numeric values for which the next number is not contained in that table for any record. So if we have records with num_val values of 1 2 3 4 5 5 should be selected. For values 1 2 3 5 6 8 3 should be selected. I wrote the following query which shows (min) 1 row retrieved but no value is displayed under min. select min(num_val) from test_table where num_val>0 and not exists (select num_val +1 from test_table) Removing the not causes the query to return 1 as expected. Should this work? Please post responses to this group. I don't have an inter-net mail account. Thanks in advance, Julie C. Jumes