Get missing numbers from table

Results 1 to 2 of 2

Thread: Get missing numbers from table

  1. #1
    Kalyani Guest

    Default Get missing numbers from table

    Hi, <BR><BR>I have a table that has one column that has incremental numbers from 1 to 10. Suppose there are 2 numbers that are missing, say<BR>5 and 9, can someone tell me if I can output the missing numbers<BR>using SQL query.<BR><BR>I already did this from VB. But I have to do it from SQL.<BR><BR>Thanks,<BR>Kalyani

  2. #2 Guest

    Default RE: Get missing numbers from table

    I think not! Sql is a QUERY language and can only tell you what is there, not what is missing. That is why we have VBS to do extra processing around our query results. <BR><BR>There are two ways round this in sql:<BR>1) Have a linked table that has all the numbers you want. Then you can do a join that picks up all the numbers from the complete table and only those rows from the other table where data exists,<BR>2) If you use SQL Server, i think that you could do it in a stored procedure. However I am not an SQL Server expert.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts