mysql - Selecting X oldest date from the database -


good afternoon

please can me, i’m total noob. have simple db has thousands of rows , few columns. have id, name, image, information, , date added. basic!

now i’m trying display single row of data @ time there no need loops , things in request. sounds simple in theory?.

i can display row in date order, , recent or oldest, ascending or descending. want able display example: = 6th newest entry. , perhaps somewhere else on sites 16 recent entry , on. 1232 recent entry.

sounds me common task can’t find answer anywhere. can provide me short command doing this? missing daft , fundamental.

thanks

leah

the limit clause can used constrain number of rows returned select statement. limit takes 1 or 2 numeric arguments, must both nonnegative integer constants (except when using prepared statements).

with 2 arguments, first argument specifies offset of first row return, , second specifies maximum number of rows return. offset of initial row 0 (not 1):

select * tbl limit 5,10;  # retrieve rows 6-15

http://dev.mysql.com/doc/refman/5.1/en/select.html

so if want 1232nd row table can this:

select * tbl order date_added limit 1231,1;

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -