Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How can I exclud weekends
Alec
HiI have the following query:
select
EMPLOYEE, COUNT(NUMBERCALLED) as TOTAL_CALLED
FROM SDDTA.PhoneReport
WHERE
(MANAGERNAME = 'X' OR
MANAGERNAME = 'Y') AND
DATE = CURRENT_DATE - 1 DAY
group by EMPLOYEE
order by count(numbercalled) desc
fetch first 5 rows only
It runs perfect and it shows data for yesterday as requested.
now I need to exclude weekends so when I run it on Mondays it will pull up data from Friday.
anybody can help please?!
Find more posts tagged with
Comments
thuston
You need a database forum for the SQL syntax.
Essentially you need to use something like DATEPART() to detect if yesterday is a weekend, then adjust your calculation accordingly.
IF yesterday = Sun: today - 3 else if yesterday = Sat: today - 2 else today - 1