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 2000 Forums
 SQL Server Development (2000)
 SQL Query : don't know how to get it

Author  Topic 

smagaz

2 Posts

Posted - 2001-07-12 : 11:49:43
I am really new in sql and this is my problem:

I would like to retrieve information from a database called DB

The table is TimeSheet with the following fields:
ProjectCode , Hours , Status

ProjectCode=name of the project
Hours= nbr of hours spent for this project
Status=ToBill,Billed,Paid

TimeSheet table contains several entries for each Project with different Hours and status
Example
ProjectA , 15 , To Bill
ProjectB , 10 , Paid
ProjectA , 7 , Billed
ProjectA , 4 , ToBill
ProjectB , 8 , Billed
ProjectB ,3 , Paid

I need a list with:
ProjectCode , Total of Hours To Bill , Total of Hours Billed , Grand Total of Hours Paid

Example:
ProjectA , 19, 7 , 0
ProjectB , 0 ,8 , 13

How can I achieve that with a sql query ?
Thanks for your help
Salva
   

- Advertisement -