MySQL Help... selecting first / last row in DB?

He has: 1,758 posts

Joined: Jul 2002

HELP!

Is there a function in MySQL that will allow me to select just the first and just the last row in a DB?

something like "SELECT LAST(ArticleID) FROM articles"

Any help would be appreciated.

Just to clarify, i'm trying to establish when i'm on the last and first row of the database so i can remove the previous and next links in a series of multipage articles... I was hoping to do this by comparing the id of the last/first entry to the id of the current entry.

Any help would be appreciated.

Thanks!

Andy

Andy

dk01's picture

He has: 516 posts

Joined: Mar 2002

I think this is correct:
SELECT MAX(ArticleID) FROM articles

-dk

He has: 1,758 posts

Joined: Jul 2002

ahhh... and i think its MIN() to get the first row isnt it?

Thanks!

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yup!
-dk

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.