Forums
This topic is locked
Skip last 3 rows
Posted 10 Jun 2003 21:24:38
1
has voted
10 Jun 2003 21:24:38 Saeed Abdi posted:
I have db and I would like the query not to show the last 3 submitted records as these are shown on the index page of the site, I did little digging and as I understand I need to use the "LIMIT" function, after modifying the query as the following SELECT * FROM indepth ORDER BY SubDate DESC LIMIT 3, 8;
I get an error stating that "I have an error in my SQL syntax near 'LIMIT 0, 8' at line 1" what is confusing me is if I test this whilst in the advance recordset window it returns the desired result.
Any help is appreciated
More info
Dreamweaver MX
Redhat
Apache 2 with php and Mysql
Edited by - xlarge on 10 Jun 2003 22:10:16
Replies
Replied 14 Jun 2003 19:23:53
14 Jun 2003 19:23:53 Marcellino Bommezijn replied:
I think LIMIT keyword is in the wrong place.
SELECT * FROM indepth LIMIT 3, 8 ORDER BY SubDate DESC
To leave out the last 3 rows will then depend on the field ORDER BY. In this case you should DESC on the ID field, so the latest 3 inserts would be ignored (?)
Edited by - mm-ultradev on 14 Jun 2003 19:28:03
SELECT * FROM indepth LIMIT 3, 8 ORDER BY SubDate DESC
To leave out the last 3 rows will then depend on the field ORDER BY. In this case you should DESC on the ID field, so the latest 3 inserts would be ignored (?)
Edited by - mm-ultradev on 14 Jun 2003 19:28:03