Payments by Service and Sort Code for Period
Back to Query Directory
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
rv_creditsplits a LEFT OUTER JOIN 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"
srvcode, COALESCE(lucode,'None') AS "Facility", sum(crsplamt) AS Payments
FROM
rv_creditsplits a LEFT OUTER JOIN 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"
CategoryQueries