Site icon SOS Resources

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"
Exit mobile version