Jump to content

mysql select first/last


shadowayex

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...