Ross

>Using mysql with php I have a database that has a unique value
>for the user id. when people get delete off the list I want the unique
>numbers to compact down so.


Generally it's a really bad idea to edit primary keys. If you absolutely must compact the key values, you can do it by altering the table to drop the primary key, then run something like this,
  SET @i=0;
  UPDATE parent2 SET id=(@i:[EMAIL PROTECTED]);

then alter the table again to re-establish the primary key.

>If this is not possible how can I find the first entry in
>the database and last entry with php/mysql?

To find the lowest id value
  SELECT id FROM tablename ORDER BY id ASC LIMIT 1;
and to find the highest
  SELECT id FROM tablename ORDER BY id DEC LIMIT 1;

PB
http://www/artfulsoftware.com

-----

[EMAIL PROTECTED] wrote:
Using mysql with php I have a database that has a unique value for the user id. when people get delete off the list I want the unique numbers to compact down so.

user id 1
user id 4
user id 5
user id 7
user id 9
user id 10

becomes 

user id 1
user id 2
user id 3
user id 4
user id 5
user id 6

If this is not possible how can I find the first entry in the database and last entry with php/mysql?

R.
  

No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 8/26/2005

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to