Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    36

    Unanswered: Get last 7 days inserted Record

    Hi All,
    i have a database, and every time when any row enter , it capture the date and time of insertation,
    then does any function or query available, which help to investigate me, today inserted record,yesterday inserted record,last 7 days inserted record,last 30 days inserted record and last year inserted record..
    i am using asp.net and MS Access...
    Any idea
    thanx in advance...
    sajjad

  2. #2
    Join Date
    Feb 2004
    Location
    Dublin, Ireland
    Posts
    212
    today's data:
    Code:
    SELECT  *  from t
    where CDate(format(your_date_column,'Short Date')) = CDate(format(date(), 'Short Date'))
    yesterday data (excluding today's):
    Code:
    SELECT  *  from t
    where CDate(format(your_date_column,'Short Date')) = CDate(format(date() - 1, 'Short Date'))
    data inserted within last week (including today's):
    Code:
    SELECT  *  from t
    where CDate(format(your_date_column,'Short Date')) >= CDate(format(date() - 7, 'Short Date'))
    and so on...

  3. #3
    Join Date
    Dec 2003
    Posts
    39

    datediff

    If u use Access 2003 u can use datediff function

    last 7 days (till today) :
    select * from tab where datediff ("d", date_time, date()) <= 6
    Link Link

Posting Permissions

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