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
 Other Forums
 MS Access
 Totaling a Summed column

Author  Topic 

tessman
Starting Member

1 Post

Posted - 2008-06-25 : 12:24:49
Hello good people of the vers.

I am a beginner with SQL, ASP,..NET and the like and have been presented with a task that has given me a bit of a challenge

I have a group of web pages that show sums based on some basic parameters. I deal with Fiscal Years, Fiscal Months what we call FCC code which are 4 digits codes for a clinic, encounters (patient visits) and Value of care. the data starts with about 3,000 entry’s in a access database, I made a simple query that asked for 1 FCC codes say "BAAA" and asked for a sum of encounters, rvu's and value of care. It looks something like this:
SELECT DISTINCTROW NEWWORKLOAD.FiscalYear, NEWWORKLOAD.FiscalMonth, NEWWORKLOAD.DMISName, NEWWORKLOAD.FCC, Sum(NEWWORKLOAD.Encounters) AS [Sum Of Encounters], Sum(NEWWORKLOAD.RVUWork) AS [Sum Of RVUWork], Sum(NEWWORKLOAD.ValueofCare) AS [Sum Of ValueofCare]
FROM NEWWORKLOAD
GROUP BY NEWWORKLOAD.FiscalYear, NEWWORKLOAD.FiscalMonth, NEWWORKLOAD.DMISName, NEWWORKLOAD.FCC
HAVING (((NEWWORKLOAD.FCC)="BAAA"));
Now this works fine, however, I need a total from three columns (Encounters, RVU's and Value of Care). it would look something like this:

Fiscal Year Fiscal Month FCC Encounters RVUWork Value Of Care
2008 1 BAAA 10 4.5 $100.00
2008 2 BAAA 20 10.5 $200.00
so on and so fourth for all 8 months. It's important to understand that the summed of one fiscal month may have 20 entry's but that is summed up in the sum statement. I need the three columns (Encounters, RVUwork and Value of Care) to total at the bottom in an additional row. It would look like this:
Fiscal Year Fiscal Month FCC Encounters RVUWork Value Of Care
2008 1 BAAA 10 4.5 $100.00
2008 2 BAAA 20 10.5 $200.00
Total 30 15.0 $300.00


Can someone please help

HitenB
Starting Member

11 Posts

Posted - 2008-07-15 : 04:28:28
Hi... I'm new to all of this as well, but check out the link below it may help - I may be totally wrong as well.. but check it out anyway:

http://www.techonthenet.com/sql/count.php
Go to Top of Page
   

- Advertisement -