From: Peter Brawley Date: August 18 2005 2:56pm Subject: Re: Deleted rows List-Archive: http://lists.mysql.com/mysql/188002 Message-Id: <4304A1A2.3050600@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=======AVGMAIL-4304A1A51C24=======" --=======AVGMAIL-4304A1A51C24======= Content-Type: multipart/alternative; boundary=------------040402070707060905030605 --------------040402070707060905030605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Scott, >How do I execute a query that shows missing ID's like so: SELECT id AS i FROM tbl WHERE i <> 1 AND NOT EXISTS( SELECT id FROM tbl WHERE id = i - 1 ); PB ----- Scott Hamm wrote: >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? > > >------------------------------------------------------------------------ > >No virus found in this incoming message. >Checked by AVG Anti-Virus. >Version: 7.0.338 / Virus Database: 267.10.12/75 - Release Date: 8/17/2005 > > --------------040402070707060905030605 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Scott,

>How do I execute a query that shows missing ID's like so:

SELECT id AS i
FROM tbl
WHERE i <> 1 AND NOT EXISTS(
  SELECT id FROM tbl WHERE id = i - 1
);

PB

-----

Scott Hamm wrote:
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?
  

No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.12/75 - Release Date: 8/17/2005
--------------040402070707060905030605-- --=======AVGMAIL-4304A1A51C24======= Content-Type: text/plain; x-avg=cert; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-Description: "AVG certification" No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.338 / Virus Database: 267.10.12/75 - Release Date: 8/17/2005 --=======AVGMAIL-4304A1A51C24=======--