shadowayex Posted June 2, 2008 Share Posted June 2, 2008 I was wondering if there was a mysql function that I could use to pull out the first or last row in a table. If not, I can write a little script to do it myself, but I figured I'd see about if there was a premade function to do it first. Link to comment Share on other sites More sharing options...
zppblood Posted June 2, 2008 Share Posted June 2, 2008 MIN() and MAX(). Link to comment Share on other sites More sharing options...
jhecht Posted June 2, 2008 Share Posted June 2, 2008 select * from table ORDER BY id_column DESC limit 1 //For the maximumSELECT * FROM table ORDER BY id_column ASC LIMIT 1 //for the minimum Link to comment Share on other sites More sharing options...
shadowayex Posted June 2, 2008 Author Share Posted June 2, 2008 select * from table ORDER BY id_column DESC limit 1 //For the maximumSELECT * FROM table ORDER BY id_column ASC LIMIT 1 //for the minimumWorks, thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.