.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to find no of employees getting weekOff in the same day for across last 4,3,2 weeks

Posted By: Naresh     Posted Date: October 14, 2010    Points:2   Category :ASP.Net
Hi,

This is my table with employees data.Right now i gave only 1 employee data of 4 weeks.

How to find whether the employee is getting weekoff in the same day for all 4 weeks,3 weeks 2 weeks.similarly other employees and return count.

For example if the employee is getting weekOff on saturday for all 4 weeks then we can count it as 1.
I want reports like this.

Some employee may get weekOff for 2 days consistenly for 4 weeks say Saturday and SUnday then that result should be display in 3rd row.

If the employee is getting weekOff on saturday for last 3 weeks and 4th week on sunday then we should add count in 3weeks column i.e 2 row 3rd column.In 4th week column it will be 0.

ConsistencyOff Across4weeks 3weeks 2weeks
0 2% 2% 2%
1 98% 98% 98%
2 0% 0% 0%

CREATE TABLE Test1(
empno int,
MatchingOff varchar(10),
atnDate datetime
)

SET IDENTITY_INSERT mytable ON

Insert into TestTable(empno,MatchingOff,atnDate)
select '101','Off','8/1/2010' union all
select '101','16:00','8/2/2010' union all
select '101','14:00','8/3/2010' union all
select '101','17:00','8/4/2010' union all
select '101','16:00','8/5/2010' union all
select '101','17:00','8/6/2010' union all
select '101','17:00','8/7/2010' union all
select '101','17:00','8/8/2010' union all
select '101','off','8/9/2010' union all
select '101','17:00','8/10/2010' union all
select '101','16:00','8/11/2010' union all
select '101','17:00','8/12/2010' union all
select '101','17:00','8/13/2010' union all
select '101','13:00','8/14/2010' union all
select '101','14:00','8/15/2010' union all
select '101','15:00','8/16/2010' union all
select '101','15:00','8/17/2010' union all
select '101','Off','8/18/2010' union all
select '101','16:00','8/192010' union all
select '101','15:00','8/202010' union all
select '101','17:00','8/21/2010' union all
select '101','14:00','8/22/2010' union all
select '101','15:00','8/23/2010' union all
select '101','15:00','8/24/2010' union all
select '101','15:00','8/25/2010' union all
select '101','Off','8/26/2010' union all
select '101','17:00','8/27/2010' union all
select '101','17:00','8/28/2010'

Responses
Author: Naresh             
Posted Date: October 14, 2010     Points: 5   

Hi All,

Please find the attachment of excel file.

Please check column (# of Days Off that Match Across last.) first they are checking off for all week days then they are counting.Based on my table can u tell me how to acheive this.Based on MatchingOff column i should check whether the employee is getting week Off in the same day for all 4 weeks,3 weeks and 2 weeks,.


Download Attachment



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend