On Mon, Jun 09, 2003 at 02:22:56PM -0400, Chris Edwards wrote: > Hi > > Does anyone have tips on the fastest way to get the last row in a table. > > What I have is an int as the the primary key, using auto inc. > > I currently do a select max(id), then run another query retrieving a row > based on the the max(id). > > Its two queries. > > Would I be able to get it all into one? > > Not using mysql 4...
SELECT * FROM mytable ORDER BY id DESC LIMIT 1 Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/ MySQL 4.0.13: up 6 days, processed 195,670,361 queries (349/sec. avg) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]