Re: selecting the last and second last id's

2007-05-28 Thread Baron Schwartz
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, whi

Re: selecting the last and second last id's

2007-05-28 Thread mos
At 04:00 PM 5/28/2007, [EMAIL PROTECTED] wrote: My primary id is an auto incrementing table and I want to return the highest and second highest id. Any ideas? You should of course have an index on Rcd_Id: Select rcd_id from mytable order by rcd_id desc limit 2 mike -- MySQL General Maili