Active Patients with No Service in Last 90 Days

SELECT 
   "name/id", 
   lfeedate as 'Last Service', 
   priprvcode as 'Primary Provider'
FROM 
   sos.rv_patients
WHERE 
   flag = 0 
   and lfeedate < (current date - 90)
You can, of course, change the date range by altering the number in the final expression. The condition
“flag = 0” restricts the output to active patients. The quotes around the column name “name/id” are
required so that the query processor does not try to divide name by id. When you enclose a string within
quotes it is treated as a column name, so embedded special characters are ignored. In this case the view
RV_PATIENTS contains an expression that creates this convenient compound value from the firstname,
lastname, and id fields.

	

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.