Results 1 to 3 of 3
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    cust with multiple orders that differ


    All, using Access 2016. Having a senior moment. I have a cust table with order numbers. I want to query only those customers with multiple order numbers but the order numbers are different. So if a customer have 3 different order numbers but 2 are the same order number; I just want it to list the 2 different ones. I have the following:
    Code:
    select  customerid,       count(*)as order_count
    from    orders
    groupby
            customerid having  count(*)>1
    This give me all the customers and the count of orders. I need to exclude if they don't have multiple different orders.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    SELECT CustomerID, OrderNumber FROM Orders GROUP by CustomerID, OrderNumber

    you can throw in a count if you want to, but it's not really necessary if you're just after a list of unique customers/orders numbers

  3. #3
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727
    Got!...Thanks so much! like I said; I was having a moment.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-01-2016, 09:04 AM
  2. Assigning multiple sequential numbers to orders
    By jree3000 in forum Programming
    Replies: 14
    Last Post: 09-09-2014, 04:35 PM
  3. Replies: 4
    Last Post: 06-06-2014, 08:50 AM
  4. Enter Orders for Multiple Customers in a Form
    By nelsonsbrian in forum Forms
    Replies: 1
    Last Post: 07-16-2013, 03:29 PM
  5. Replies: 1
    Last Post: 05-05-2010, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums