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
 Transact-SQL (2000)
 Sub heading and subtotals

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-04-06 : 20:02:56
Aiyaz writes "Hi,
Im trying to do a query on a table which returns the results in a report format.


SQL Query:
select timeentrydatetime, userid, comments,hours
from dbo.submittedtimeentries


I want the results to have a group by "timeentrydatetime" and print the timeentrydatetime field as a subheading. for each sub heading I want to total the hours.


Something similar to this:



Description Hours Tasks Billable
Friday, 31 March 2006
O4B, Web & Integration 1.6 Admin,meetings Non-Billable
O4B, Web & Integration 1.6 Admin,meetings Non-Billable
O4B, Web & Integration 1.6 Admin,meetings Non-Billable
Total: 4.9

Sunday, 2 April 2006
Presales BONZ Zespri 10 Basis Billable
O4B, Web & Integration 5 Admin,meetings Non-Billable
Production Support GENERIC 1 Design&planning Billable
Total: 25




Ive tried several examples but failed to get the results I wanted. Can you please please help.

Thanks
Aiyaz"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-07 : 01:42:14
Cant you use Reports to do this?
Otherwise look for COMPUTE clause in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -