on 2014 Mar 04 11:32 AM
I am trying to get all the applications which was updated before 5 business day
I am able to to get all the applications by using the following where clause calculation.
Also, I would like to display the number of day it was last updated.
SELECT A.APP_NUM
FROM Application A,
WHERE
((Dayofyear(CURRENT_DATE) - Dayofyear(cast (A.LAST_UPDATE_TIMESTAMP as DATE))) + 1) - ((Week(CURRENT_DATE) - Week(cast (LAST_UPDATE_TIMESTAMP as DATE))) * 2) - (case when DAYOFWEEK(CURRENT_DATE) > 6 then 1 else 0 end) - (case when DAYOFWEEK(cast (LAST_UPDATE_TIMESTAMP as DATE)) < 2 then 1 else 0 end) >5
Request clarification before answering.
User | Count |
---|---|
60 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.