» Birthday Bundle - Over $400 worth of Envato files for just $20

Get maximum ID from a table

Posted on August 30, 2008, Filled under PHP,  Bookmark it

To get the maximum id from a table you can use the MAX() function.

Here’s an example:

SELECT MAX(id_field_here) as max_id FROM `table`;

Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!

Get our RSS Feed!

One Reply to "Get maximum ID from a table"

  1. Mixing of GROUP columns (MIN(),MAX(),COUNT(),…) with no GROUP columns is illegal if there is no GROUP BY clause

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)