List:General Discussion« Previous MessageNext Message »
From:SGreen Date:August 18 2005 1:15pm
Subject:Re: Deleted rows
View as plain text  
Scott Hamm <linuxgold@stripped> wrote on 08/18/2005 08:59:00 AM:

> If I got a table as follows:
> 
> 
> ID foo
> 1 12345
> 2 12346
> 4 12348
> 6 12349
> 7 12388
> 9 12390
> How do I execute a query that shows missing ID's like so:
> 
> 3
> 5
> 8
> 
> I wouldn't expect for it to show deleted data that was deleted, just 
show 
> the "skipped" ID's.
> 
> That way I determine if operator deleted too much (cheating at QC)
> 
> Is it possible?


It is possible, however because SQL is designed more to show you what is 
in the database better than what is not in the database, you will need to 
make a list of numbers and check for those records not in the list. See 
this thread: http://lists.mysql.com/mysql/187981  (some of which was 
posted just last night) describing how to fill in missing dates. Yours is 
the exact same problem but instead of dates, you are trying to find 
missing numbers.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
Thread
Deleted rowsScott Hamm18 Aug
  • Re: Deleted rowsSGreen18 Aug
  • Re: Deleted rowsPeter Brawley18 Aug
    • Re: Deleted rowsSGreen18 Aug
      • Re: Deleted rowsScott Hamm18 Aug
      • Re: Deleted rowsPeter Brawley18 Aug
RE: Deleted rowsemierzwa18 Aug