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 |
katbrennan
Starting Member
1 Post |
Posted - 2011-03-11 : 14:17:42
|
Hello,Could someone please tell me how to calculate a subtotal? I have two tables, one with transactional data and account numbers, and the other table with line numbers, line descriptions and accout numbers. The tables are joined on account number. What I want is to pull a monthly amount and then group certain line numbers together and have subtotals. I want my result set to look like this:1. Line Description 1 100.002. Line Description 2 400.003. Line Description 3 200.004. Subtotal Revenue 700.005. Line Description 4 500.006. Line Description 5 100.007. Subtotal Expenses 600.00and so on...I am about to get the monthly amounts for the regular lines, just not for the subtotals. So what I would like to do would be something like this:If line number = 4 then sum lines 1, 2, 3If line number = 7 then sum lines 5, 6Is this possible?Thanks. |
|
|
|
|