Home » questions » DB2 and ACCESS - limitation of the query result?

DB2 and ACCESS - limitation of the query result?

2006-08-02 06:48:22, Category: Programming & Design
How can I limit the number of rows in the result of my query ? (with DB2 and ACCESS) The equivalent of WHERE ROWNUM < 100 with ORACLE I think it's something like FETCH FIRST n ROW for DB2 but I'm not sure And I don't know for ACCESS...

Answers

  1. nigel h

    On 2006-08-02 09:54:16


    if you first create a query within Access, and then select the dropdown box from the menu bar which will probably contain "All", and change this to one of the other numbers, eg 100, or 25%, and then click on the SQL button to the far left, it should show you the code generated. in DB2 SQL I'm sure you've got it right - Fetch First n Rows
  2. Paul B

    On 2006-08-02 07:44:21


    Have you tried 'SELECT TOP n ' Where n is the number of rows you want? or you can do SELECT TOP n PERCENT where n is the percent of rows needed?