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 2005 Forums
 Transact-SQL (2005)
 Group by on joined tables

Author  Topic 

zokhox
Starting Member

4 Posts

Posted - 2012-06-27 : 20:03:12
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
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-06-28 : 02:19:07
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
   

- Advertisement -