Results 1 to 5 of 5
  1. #1
    tosho is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    2

    need help with creating a certain query

    Good evening, I have a question of how to pull all the customers that made 4 or more purchases in 60 days.
    my table contains


    customer number
    purchase order number(unique for each purchase)
    purchase date (covering 2 years).

    I would truly appreciate your help.

    Thank you!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    In 60 days from when - today or any 60 day period for the 2 years? Don't think latter will be easy.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tosho is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    2
    I know it's confusing, but there is no period, if customer purchased something, did he purchased 3 or more items since his last purchase in 60 consecutive days.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I was right, too tricky for me to tackle. Requires calculating the number of purchases that follow each purchase for the subsequent 60 days, a 'rolling' interval. Evaluating data in related records is not easy. Here is a fairly simplistic example of getting data from another record http://allenbrowne.com/subquery-01.html for calculating with the current record. So for each purchase date need to check if 3 more purchases within 60 days. The clue might be within Allen Browne's tutorial but too tired right now to think it through. VBA might be easier.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Is it that, if a customer made a purchase today, you want to find out if 3 or more purchases have been made in the past 60 days from today by the Customer.

    Thanks

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

Similar Threads

  1. Creating a Query Need HELP
    By ampd in forum Queries
    Replies: 1
    Last Post: 02-16-2011, 12:12 PM
  2. Creating SQL query with one-to-many field
    By slaterino in forum Queries
    Replies: 2
    Last Post: 09-08-2010, 07:56 AM
  3. Creating a Grouping query
    By Dev in forum Access
    Replies: 4
    Last Post: 09-02-2010, 06:46 AM
  4. Creating input box for query
    By dcecil in forum Queries
    Replies: 1
    Last Post: 06-23-2009, 10:08 AM
  5. Creating INT function within a Query
    By LCorrieri in forum Queries
    Replies: 3
    Last Post: 01-25-2008, 10:38 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