Results 1 to 2 of 2
  1. #1
    baba is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    43

    To select max 13 dates from an MsAccess table using SQL

    How to select rows based on last 13 dates from a table.

    Suppose today is March 15,2012 and if the table has data between
    March 2012 to Jan 2000,my query should pick up data between
    March 2012 to March 2011. (13 months)



    Similarly, today is March 15,2012 and if table has data from Feb 2012 to Jan 2000 and the table does not have March 2012 data,then the query should pick up data from
    Feb 2012 to Feb 2011. (13 months) .

    I am running a query to pick up data from msaccess table to create reports. Thanks for the help!

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Your example above shows that you are only using the previous 13 months as opposed to the previous 13 dates. Is that correct? If so, use DateDiff to subtract 13 months from Max(datefield).

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

Similar Threads

  1. Learn MSAccess by playing MSAccess Jeopardy
    By pkstormy in forum Sample Databases
    Replies: 4
    Last Post: 11-17-2016, 07:27 AM
  2. Replies: 1
    Last Post: 12-03-2011, 01:26 AM
  3. Custom calendar - select multiple dates
    By larek in forum Access
    Replies: 6
    Last Post: 06-23-2011, 02:40 AM
  4. Replies: 5
    Last Post: 04-28-2011, 05:10 PM
  5. Select last 2 dates of service
    By kfinpgh in forum Queries
    Replies: 1
    Last Post: 11-25-2009, 07:34 PM

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