Forum Moderators: coopster

Message Too Old, No Replies

Skip first 8 rows in database?

Skip first 8 and select the next 8 rows

         

dbzfyam

2:23 pm on Oct 29, 2005 (gmt 0)

10+ Year Member



I'm trying to write a news part for my CMS system. I also have a archive of the already submitted news. I do not, however, want to display the first 8 rows from the database (which will be displayed on the main page). I currently have this query:

SELECT * FROM nieuws ORDER BY ID DESC LIMIT 8

I do not want to display those 8 rows in the archive. I tried several things but I keep ending up with some or all of the front-page entries in the archive.

Can someone tell me how I can do this?

Thanks in advance,
Stefan

jatar_k

2:43 pm on Oct 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you can use an offset with your limit clause

from
[dev.mysql.com...]
(you can search that page for LIMIT)

LIMIT offset, row_count

initial offset is 0 so you could do

LIMIT 7,8

this would give you the next 8 results

dbzfyam

4:22 pm on Oct 29, 2005 (gmt 0)

10+ Year Member



Thank you very much jatar_k! Got it working. Didn't think this would be so easy to do.

Thanks again!