Results 1 to 2 of 2

Thread: How to pull the most recent order for each customer?

  1. #1
    Join Date
    Feb 2009
    Posts
    1

    Question How to pull the most recent order for each customer?

    I have a db that is full of orders, along with the customers name, address, etc. There are multiple entries for each customer because they have purchased things more than once. I need to export a table that has all the customers and only their most recent order. I figure I can use the `id` field because they are unique and the highest `id` means the most recent.

    I just need to filter out the most recently entered `id` along with the rest of the info in the fields all the way down the row for each customer.

    The table is named orders and the id is just called `id`

    Any ideas??

  2. #2
    Join Date
    Jun 2009
    Location
    Stockholm
    Posts
    2
    Are you using SQL Queries ? In that case just ordering your id column in descending order isn't it what you are looking for ?

    ________________________
    More DB ? visit http://www.raima.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •