Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

SSRS 2005 - Return all working days between two dates

$
0
0

Hi all

I have a requirement to report on all hours posted between two dates, @StartDate and @EndDate. My query is currently:

SELECT PROJJOURNALTRANS.EMPLID, PROJJOURNALTRANS.QTY, PROJJOURNALTRANS.PROJTRANSDATE FROM PROJJOURNALTRANS
WHERE (PROJJOURNALTRANS.PROJTRANSDATE >= @StartDate) AND (PROJJOURNALTRANS.PROJTRANSDATE <= @EndDate) ORDER BY PROJJOURNALTRANS.EMPLID, PROJJOURNALTRANS.PROJTRANSDATE

However, this obviously doesnt include any days where no hours were posted. I need to include ALL WORKDAYS between @StartDate and @EndDate, whether there are any hours or not. Currently, if @StartDate = 14/12/2012 and @EndDate = 20/12/2012, I get:

EmplID   Projtransdate     Qty
User1      14/12/2012       7.75
User1      17/12/2012       7.75
User1      20/12/2012       7.75

What I want to return is:

EmplID   Projtransdate     Qty
User1      14/12/2012       7.75
User1      17/12/2012       7.75
User1      18/12/2012       0
User1      19/12/2012       0
User1      20/12/2012       7.75

15/12/2012 and 16/12/2012 are Saturday and Sunday, so there shouldnt be anything returned for those days

Can someone please help me figure out how to do this??

Thanks for all help
Naz


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>