Search code examples
sqlms-accessasp-classic

Access Database LIMIT keyword


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?


Solution

  • 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)..