Results 1 to 3 of 3

Thread: Beginner Query question

  1. #1
    Join Date
    Jun 2004
    Location
    Springville, UT
    Posts
    2

    Beginner Query question

    I have a large database table that I'm doing a query on. I hope that I can explain this well enough.

    I have set up the fields that I want in the quary, sorting out the date for the month of june, sorting out the type of part numbers that I'm looking at.

    the problem that I'm hitting is the orders. I can have many part numbers on the same order, but I want to only have it show or count the multiple order numbers as one to get a count of just the unique orders that were shipped.

    eg. p/n abc order# 001
    p/n bcd order# 001
    p/n cde order# 001
    p/n abc order# 002

    I want this to just show me that I had 2 orders not 4. I'm working with thousands of records but know that it is really just a few hundred unique orders that I want to get a count on.

    I know what I want this to do for me, but can't for the life of me find what the function to do this is called to get me closer to solving this problem.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    if you create a query with just the order # in it and click on the sigma button on the button bar menu then it will GROUP BY the order number.

    If you then base another query on this query and do the same but change the GROUP BY part of the query to COUNT. You will get a count of the # of orders.

    hope that helps a bit anyway ?

  3. #3
    Join Date
    Jun 2004
    Location
    Springville, UT
    Posts
    2

    Thumbs up Found

    Thanks for your help. I can see what you are saying. I actually have another table where I'm going to use that.

    I learned the distinct command, last night, in SQL, and that worked like a champ. Took 1573 records and weeded out those that were unique down to 900.

Posting Permissions

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