Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    10

    Thumbs up Unanswered: select based on previous date value

    I want to do a select statement based on the previous twelve months is there a way I can tell SQL to look back 12 months based either on a field value which is date time field or on the system date value?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    well, when you think about it, you'd need both, the field datetime value and the system current datetime value

    PHP Code:
    select foobardatetimefield
      from yourtable
     where datetimefield 
    >= current_date interval 12 month 
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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