select MAX(fieldname) from table; You can also insert data in tables with auto_increment fields to account for yourneed to insert old member ids.
insert into tablename (ID, Name) values ('$OldID', '$Name'); -----Original Message----- From: César Aracena [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 12, 2002 11:36 AM To: 'PHP DB List'; PHP General List Subject: [PHP] Querying for MAX I'm sorry if this mensaje is posted twice. I sent it yesterdays, but then my ISP had problems with e-mail and I lost dozens of them and don't know if sent OK. Hi all, What I'm trying to do here is not inside PHP nor MySQL books I have. I need to query the DB to look the max result in a column. That is, if I have affiliate members with ID going from 1 to 10, get the query to know that the last member added was 10 so I can add member 11 without using auto_increment, because I need to insert old members too which already have ID numbers. Is that possible? Thanks in advance, Cesar Aracena <mailto:[EMAIL PROTECTED]> CE / MCSE+I Neuquen, Argentina +54.299.6356688 +54.299.4466621 **************************************************************************** This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php