Patients with Appointments Today and a Significant Balance, Sorted by Site and Provider
Back to Query Directory
List the names of patients with balances of $120 or more, sorted by site and provider, who are scheduled to be seen on the day the query is run.
SELECT
a.sitename+' ('+a.sitecode+')' AS "site",
(a.provlname+', '+a.provfname+' ('+provcode+')') AS "provider",
a.ptfullname,
a.id,
b.ptbalance
FROM
rv_appts a
JOIN pt_noninsbalance b ON a.ptnum = b.ptnum
WHERE
b.ptbalance >= 120
AND a.cancelflag = 0
AND a.apptdate = TODAY()
ORDER BY
"site","provider",a.ptfullname,a.id
a.sitename+' ('+a.sitecode+')' AS "site",
(a.provlname+', '+a.provfname+' ('+provcode+')') AS "provider",
a.ptfullname,
a.id,
b.ptbalance
FROM
rv_appts a
JOIN pt_noninsbalance b ON a.ptnum = b.ptnum
WHERE
b.ptbalance >= 120
AND a.cancelflag = 0
AND a.apptdate = TODAY()
ORDER BY
"site","provider",a.ptfullname,a.id
CategoryQueries