|
|
Back to UserFriendly Strip Comments Index
| SQL help needed again. |
by Freakazoid |
2008-10-01 10:34:22 |
This is for SQL Server 2005.
have a rather interesting query i'm putting together (based on examples i've found online here and there) for an annoying project for the big bossman.
here's the query so far:
select datepart(month, DOS) Month, sum([chrg amt]) 'Gross Charges', sum(adjustments) Adjustments, sum(paid) Payments, sum(balance) Balance, sum([pt bal]) 'Pat Due', sum([ins bal]) 'Ins Due'
from [ANSI-RPT-ALL]
where DOS >= convert(datetime,'2008-06-01',120) and CLT = 'bel'
group by datepart(month, DOS)
order by Month;
What I need to do now is put in a field that's the gross charges minus the adjustments (called "net charges")
Also need a field that's the payments divded by the net charges. (as a percent) This might be problematic because payments is a negative number in the data that gets brought back. |
|
[ Reply ] |
|
forgot to mention: | by Freakazoid | 2008-10-01 10:36:49 |
|
blah, correction: | by Freakazoid | 2008-10-01 10:38:48 |
|
You can do net charges (or should be able to) | by MatthewDBA | 2008-10-01 10:42:22 |
|
well, sorta (got it now) | by Freakazoid | 2008-10-01 10:49:15 |
|
ok, simple question time | by Freakazoid | 2008-10-01 11:28:58 |
|
First off | by MatthewDBA | 2008-10-01 11:44:08 |
|
hmm, didn't work | by Freakazoid | 2008-10-01 11:51:07 |
|
Here's a crummy hack I found: | by merlin | 2008-10-01 12:13:13 |
|
|
[Todays Cartoon Discussion]
[News Index]
|
|