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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Group by on joined tables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

zokhox
Starting Member

Australia
4 Posts

Posted - 06/27/2012 :  20:03:12  Show Profile  Reply with Quote
Hi
I have 3 tables as:
Worker (WorkerID, WorkerName),
WorkOnProject (ProjectID, WorkerID, NumberDays)
AbsentOnProject (ProjectID, WorkerID, AbsentDays) "AbsentDays is a negative number"

I need to write a query which shows WorkerID, WorkerName and a column which shows the result of (NumberDays + AbsentDays) for each worker.

Please note that there could be multiple Absent records for each worker in the AbsentOnProject table. So I think I should Sum AbsentDays for each worker first then add the result to NumberDays in the WorkOnProject

webfred
Flowing Fount of Yak Knowledge

Germany
8515 Posts

Posted - 06/28/2012 :  02:19:07  Show Profile  Visit webfred's Homepage  Reply with Quote
duplicate post - please don't do that...

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=176232


No, you're never too old to Yak'n'Roll if you're too young to die.
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.05 seconds. Powered By: Snitz Forums 2000