If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Getting Previous Monday

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-03, 17:13
westfour westfour is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 11-21-03, 06:48
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Re: Getting Previous Monday

Quote:
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On