× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks for your reply Tom
I realize that DAYOFWEEK was the path to go and I have to play around with it
However - looking at your code - wont Sunday be a problem
DAYOFWEEK for Sunday will be 1
Minus 2 results in the answer of -1, correct?

Alan Shore
Solutions Architect
IT Supply Chain Execution

[cid:image001.png@01D79F18.5F9C76C0]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx

'If you're going through hell, keep going.'
Winston Churchill

From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Tom Hambel
Sent: Wednesday, September 1, 2021 9:57 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: [EXTERNAL] RE: In SQL how to calculate how many days ago last Monday

SELECT
DAYOFWEEK(CURRENT TIMESTAMP) as curday#,
case
when DAYOFWEEK(CURRENT TIMESTAMP) =2 then 7
else DAYOFWEEK(CURRENT TIMESTAMP)-2
end as Last_monday_days_ago,
CASE DAYOFWEEK(CURRENT TIMESTAMP)
WHEN 1
THEN 'SUNDAY'
WHEN 2
THEN 'MONDAY'
WHEN 3
THEN 'TUESDAY'
WHEN 4
THEN 'WEDNESDAY'
WHEN 5
THEN 'THURSDAY'
WHEN 6
THEN 'FRIDAY'
ELSE
'SATURDAY'
END AS DAYTEXT


FROM SYSIBM.SYSDUMMY1;

CENTRAL SEMICONDUCTOR CORP. CONFIDENTIALITY NOTICE: This electronic mail transmission may be privileged, contain trade secrets, or otherwise confidential information and should be read or retained only by the intended recipient. If you have received this transmission in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com<https://amazon.midrange.com>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.