Additions:
AND a.cancelflag = 0
Revision [449]
Edited on 2011-05-04 10:25:23 by adminAdditions:
=====Patients with Appointments Today and a Significant Balance, Sorted by Site and Provider=====
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.apptdate = TODAY()
ORDER BY
"site","provider",a.ptfullname,a.id
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.apptdate = TODAY()
ORDER BY
"site","provider",a.ptfullname,a.id
Deletions:
comments here appear in italics
paste your tested query here