SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Please help: query to show time Monday to Sunday
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rokasra
Starting Member

2 Posts

Posted - 07/17/2014 :  09:59:16  Show Profile  Reply with Quote
Hi guys,

I need some help for one query. I would like to show employee work hours daily from monday to Sunday. I have managed to write a query to get the total hours.

This is the query giving total hours from and to date.

(select sum(t.timespent)/60 from timeitems t
where t.employee = e.code
and t.project = p.code
and t.ndate >= '2014-07-15'
AND t.ndate <= '2014-07-15') as Hours
from projemplink pl


Thank you in advance

SwePeso
Patron Saint of Lost Yaks

Sweden
30265 Posts

Posted - 07/17/2014 :  13:41:11  Show Profile  Visit SwePeso's Homepage  Reply with Quote
	(
		SELECT	SUM(t.TimeSpent) / 60E
		FROM	dbo.TimeItems AS t 
		WHERE	t.Employee = e.Code 
			AND t.Project = p.Code
			AND t.nDate >= '20140715' 
			AND t.nDate <  '20140716'
	) AS [Hours]
from	dbo.ProjEmpLink AS pl



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000