I'm trying to get my page listing function working in ASP with an Access database, but I don't know the alternative to LIMIT in Microsoft SQL. I have tried TOP but this doesn't seem to be working.
Here is the statement am using with MySQL:
SELECT * FROM customers ORDER BY customerName DESC LIMIT 0, 5
How can I convert this to work with Access Database?
According to ms-access view:
SELECT TOP(5) * FROM customers ORDER BY customerName;
will fetch an error "The SELECT statement includes a reserved word",
the correct syntax is:
SELECT TOP 5 * FROM customers ORDER BY customerName;
(note the brackets)..
Top(5) is deceptive. Internally the database returns all records, then Access just shows the Top 5 rows. I'd use the LIMIT keyword instead of Top(n).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With