Sql Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xtianixm
    New Member
    • Jul 2007
    • 52

    #1

    Sql Query

    i use a MS access database. if i a have 20 record in my database. what is the query when i want only 10 record to display?
  • shuvo2k6
    New Member
    • Jan 2008
    • 68

    #2
    Originally posted by xtianixm
    i use a MS access database. if i a have 20 record in my database. what is the query when i want only 10 record to display?

    Hi,
    Here you do not mention what 10 records, first or last. For my method, you have to add an extra field that indicates the original position or number of data in those records. Then you can do that by WHERE clause. You can use like this 'WHERE ID<11'.

    Get Better.

    Regards,
    shuvo2k6
    Last edited by Killer42; Jan 31 '08, 05:28 AM. Reason: Corrected "u" a number of times.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Moved from VB to Access forum.

      Comment

      • Jim Doherty
        Recognized Expert Contributor
        • Aug 2007
        • 897

        #4
        Originally posted by xtianixm
        i use a MS access database. if i a have 20 record in my database. what is the query when i want only 10 record to display?
        You use the TOP clause in SQL

        SELECT TOP 10

        which in Access equates to right clicking in the query designer where the tables are and selecting the properties box where you will see the property called 'Top Values' insert there the number of rows you wish to retrieve. You will only get the number of rows you state and it will be the first 10 rows if that is your stipulation. How you sort and sift using criteria is a different matter

        Regards

        Jim :)

        Comment

        Working...