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.