Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    1

    Unanswered: Getting Previous Monday

    Hi,

    I am trying to put together a query to give me the previous Monday in yyyy-mm-dd format. If the date is Monday, it would return today.

    I have:
    select distinct weekday('2003-11-20') from some_table

    which returns 4. Ultimately, I need to have query return '2003-11-17' instead of the interval.

    I'm kind of at a loss on this and would appreciate any help.

    TIA,

    Jeff

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: Getting Previous Monday

    Originally posted by westfour
    Hi,

    I am trying to put together a query to give me the previous Monday in yyyy-mm-dd format. If the date is Monday, it would return today.

    I have:
    select distinct weekday('2003-11-20') from some_table

    which returns 4. Ultimately, I need to have query return '2003-11-17' instead of the interval.

    I'm kind of at a loss on this and would appreciate any help.

    TIA,

    Jeff
    Hi,

    If badly I do not understand, please check with:

    select distinct weekday('2003-11-20') from some_table
    where extend(weekday, month to month) = 10

    Gustavo.

Posting Permissions

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