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.
Author |
Topic |
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-02-20 : 14:50:35
|
hi there i need to do a select that sum all the records from a day and shows after the end of the day examplei have this tableidbill service price date (mm/dd/yyyy)1 wash 55 '01/01/2012'2 wash 55 '01/01/2012'3 wash 70 '01/02/2012'4 wash 65 '01/02/2012'i want to do a select with this result (but i dont know how)idbill service price date (mm/dd/yyyy)1 wash 55 '01/01/2012'2 wash 55 '01/01/2012' total 1103 wash 70 '01/02/2012'4 wash 65 '01/02/2012' total 135and etcany help will be appreciatethanks in advanced |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-20 : 14:57:34
|
quote: Originally posted by sebastian11c hi there i need to do a select that sum all the records from a day and shows after the end of the day examplei have this tableidbill service price date (mm/dd/yyyy)1 wash 55 '01/01/2012'2 wash 55 '01/01/2012'3 wash 70 '01/02/2012'4 wash 65 '01/02/2012'i want to do a select with this result (but i dont know how)idbill service price date (mm/dd/yyyy)1 wash 55 '01/01/2012'2 wash 55 '01/01/2012' total 1103 wash 70 '01/02/2012'4 wash 65 '01/02/2012' total 135and etcany help will be appreciatethanks in advanced
[code]select idbill, service, price, date from tableunion allselect 0,service,sum(price),datefrom tablegroup by service,dateorder by service,date,idbill desc ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-02-20 : 15:16:15
|
THANKS AGAINyour answer worksbut are there any other way to do? may be more elegant, i need to send a report with this informationmany thanks |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-20 : 15:19:07
|
not any other easier ways in sqlyou can very easily generate this format it most reporting tools using report group footers------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-02-20 : 15:28:41
|
many thanks kind regards |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-20 : 15:57:18
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|