• Last 5 records (Access 2K)

    Author
    Topic
    #403068

    Is there a syntax in SQL that will allow me to select only the last 5 transactions record for each customer?

    Viewing 3 reply threads
    Author
    Replies
    • #807509

      That is largely dependent on the record structure. Assuming that you have a method for sorting them that shows you the most recent record first, you can use the TOP option to specify the top 1,2 5, 10 or whatever. You can also set that in the QBE view by displaying the properties for the query and replacing ALL in Top Values with 5.

    • #807510

      That is largely dependent on the record structure. Assuming that you have a method for sorting them that shows you the most recent record first, you can use the TOP option to specify the top 1,2 5, 10 or whatever. You can also set that in the QBE view by displaying the properties for the query and replacing ALL in Top Values with 5.

    • #807511

      Assuming you have a time/date stamp, transaction# and customer# in the transaction table, base a new query on the transaction table and bring down the fields in the order that I listed them, making sure the time/date stamp is the furtherst to the left. Sort descending by date/time stamp. Add criteria so you select transactions for the customer you wish. Right click in the top pane of the query designer and chose Properties. You’ll see a Top Values property you can set — enter the number 5 to get the last five transactions.

    • #807512

      Assuming you have a time/date stamp, transaction# and customer# in the transaction table, base a new query on the transaction table and bring down the fields in the order that I listed them, making sure the time/date stamp is the furtherst to the left. Sort descending by date/time stamp. Add criteria so you select transactions for the customer you wish. Right click in the top pane of the query designer and chose Properties. You’ll see a Top Values property you can set — enter the number 5 to get the last five transactions.

    Viewing 3 reply threads
    Reply To: Last 5 records (Access 2K)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: