Payments by Service and Sort Code for Period

I need a break down of payments totalled by Service Code and Sort Code. We use the SortCode field on the Charge entry to indicate the facility where the services were rendered.

SELECT
  srvcode, COALESCE(lucode,'None') AS "Facility", sum(crsplamt) AS Payments
FROM
  sos.rv_creditsplits a LEFT OUTER JOIN sos.lookups b ON a.srv_sortcode = b.lunum
WHERE
  CredType <> 'Adjustment'
AND
  Srv_Date BETWEEN '2008-01-01' AND '2008-12-31'
GROUP BY
  srvcode, "Facility"
ORDER BY
  srvcode, "Facility"

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.