Hi!

[EMAIL PROTECTED] wrote:
My primary id is an auto incrementing table and I want to return the highest 
and second highest id.

Any ideas?

The simplest answer I can think of is

  SELECT id FROM tbl ORDER BY id DESC LIMIT 2;

This general problem, and its variations, has many solutions, which you can read about here if you are interested:

http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/

Cheers
Baron

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

Reply via email to