Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    28

    Unanswered: Advice on 'datetime year to date' for novice

    My table has a date field defined as ‘datetime year to second’
    When selected, it looks like “2009-08-31 10:55:27”.
    I have never seen this date definition before.
    My query needs to retrieve all rows whose date is yesterday,
    dropping hour, minute, & second.
    Can anyone advise me of the syntax ?
    Many thanks

  2. #2
    Join Date
    Jul 2009
    Posts
    37
    The simplest way to do that is to use the date function, e.g.

    select date(your_datetimefield)
    from your_table
    where date(your_datetimefield) = (TODAY -1)

  3. #3
    Join Date
    Jul 2009
    Posts
    28

    Advice on 'datetime year to date' for novice

    thanks bigcalm
    this works a treat.
    best wishes

Posting Permissions

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