Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SQL to work out a continuous 30 working days

Author  Topic 

paul27uk
Starting Member

9 Posts

Posted - 2010-08-18 : 04:30:49
Hi.

I have been tasked with the above and really don't know where to start. A bit of background.


DECLARE @WorkBoost TABLE
(
AP_PK INT NOT NULL
,WBO_FK INT IDENTITY(1,1)
,WBOStatus INT -- 1 Active
,ActualStart DATETIME
,ActualEnd DATETIME

UNIQUE(AP_PK,WBO_FK)
)

INSERT INTO @WorkBoost(AP_PK,WBOStatus,ActualStart,ActualEnd)
VALUES
(1,1,'02/08/2010','06/08/2010')
,(1,1,'09/08/2010','13/08/2010')
,(1,1,'16/08/2010','20/08/2010')
,(1,1,'23/08/2010','27/08/2010')
,(1,1,'30/08/2010','03/09/2010')-- Bank Holiday
,(1,1,'06/09/2010','10/09/2010')
,(1,1,'13/09/2010','17/09/2010')
,(2,1,'13/07/2010','17/09/2010')



So each person (ActionPlan) has 0:Many Objectives. I have been asked to write a report that can basically look at all the said Objectives per action plan and if any do not have a continuous period of 30 working days, I am to return them in the report as an exception. We have another table that records bank holidays and closures as these are to not be classed as breaks in the 30 days, along with weekends.

If people can help that would be much appreciated. If you require any further information please let me know.

MSquared
Yak Posting Veteran

52 Posts

Posted - 2010-08-18 : 10:51:08
Not sure what you are asking? Based on the data you provided, what would you expect for results?
Go to Top of Page
   

- Advertisement -