E-Mail Addresses For Active Patients

I need a list of active patients with their email addresses. Only list those with emails, and sort in order by name.

SELECT DISTINCT
a.lastname, a.firstname, b.email
FROM
sos.patients a JOIN payors b ON a.payornum = b.payornum
WHERE
flag = 0 AND dischargedate IS NULL AND email > ''
ORDER BY
a.lastname, a.firstname, b.email

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.