The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

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 Freakazoid2008-10-01 10:36:49
  blah, correction: by Freakazoid2008-10-01 10:38:48
  You can do net charges (or should be able to) by MatthewDBA2008-10-01 10:42:22
    well, sorta (got it now) by Freakazoid2008-10-01 10:49:15
  ok, simple question time by Freakazoid2008-10-01 11:28:58
    First off by MatthewDBA2008-10-01 11:44:08
      hmm, didn't work by Freakazoid2008-10-01 11:51:07
        Here's a crummy hack I found: by merlin2008-10-01 12:13:13

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)