Results 1 to 11 of 11
  1. #1
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41

    Query for nonreturned order

    Hi there,

    This might be a simple question to you. But I am struggling with it.

    I am trying to query for the orders which are not checked as return in my order tracking table. That is, if order 1 is made by customer 10001 on 1/3/2012, but the customer returns it on 1/10/2012, all order tracking records should not be selected. And I also want to restrict selection as any order made after 1/5/2012.

    I attach the database here. Could you help me with it?

    If you could provide me with a query setup, that would be great!

    Thank you very much.

  2. #2
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Query for nonreturned order

    Hi lizzywu,

    Is this what you are looking for?

    Thanks

  3. #3
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41
    No. What I'd like to have is the orders listed in my torder, which are made after 1/5/2012 and the orders which are returned should not show up either. This should give me the following list:

    subject_id order_id order_content order_date
    10003 3 clips 1/6/2012
    10004 5 clips 1/9/2012
    10006 8 paper 1/12/2012

    Is it possible that you try it again for me? Really appreciate.

  4. #4
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Query for nonreturned order

    Hi Lizzywu,

    Ok, does this look right?

  5. #5
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41
    Thank you so much for your effort, Bigroo.

    But since subject#10002 did return on 1/11/2012 as order#6 shows. Any order which is returned should not show up, so order#2 made by #10002 should not be in the results.

    Could you please help me check again? Millions of thanks!

  6. #6
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41
    Also, another question is: how could I query for the maximum order# for each subject?

    Thank you a lot.

  7. #7
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Query for nonreturned order

    Hi Lizzywu,

    Please review the DB, i added another field to torder named returned date, this way you have only one entry per order. Not too sure if this is the approach you wish!!

    The query does show the correct results then.

    As to you second question:

    Also, another question is: how could I query for the maximum order# for each subject?
    I dont follow what you wish to see? Do you wish total number of orders per subject?

    Thanks

  8. #8
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41
    Thank you, Bigroo.

    There was a field called order_date which indicates both order date and return date. The DB you attached gives the orders made after 1/5/2012. As subject#10002 returned on 1/11/2012 as order#6 shows, it should not show in the results.

    Or, could you help me try querying for the orders made by each customer most recently?

    Thanks a lot.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    I have AC2003 so can not look at your 2010 data base nor database attached as responses.
    However,
    a field called order_date which indicates both order date and return date
    this is a poor set up. One field, one concept.

  10. #10
    lizzywu is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    41
    Orange, I understand the poor setup I made. But is it possible to query for the most recent order made by each customer if a customer can make more than one order? I tried to use last[order_date] and max[order_date]; neither of them worked.

    Thank you.

  11. #11
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Something like this

    SELECT Max(Order_Date) AS MaxOfOrder_Date
    FROM YourTable
    GROUP BY CustomerName;

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

Similar Threads

  1. Have query Display Days in Order
    By jo15765 in forum Queries
    Replies: 3
    Last Post: 09-27-2011, 08:59 AM
  2. Id Order
    By Rockin-John in forum Forms
    Replies: 15
    Last Post: 05-03-2011, 02:39 PM
  3. Replies: 6
    Last Post: 04-13-2011, 06:55 PM
  4. Query to flag daily change in order status
    By Relyuchs in forum Queries
    Replies: 1
    Last Post: 01-21-2011, 02:53 PM
  5. Query results order
    By Costa in forum Queries
    Replies: 6
    Last Post: 02-24-2010, 06:07 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