July is coming soon and that's when we inactivate old physical records and store them away to make space in our office. We still don't have digital x-rays so we have folders to file away the patient's radiographs. After five years we make a list, remove them, and store them in boxes a closet. I came up with a query to make the list and it will select patients whose last visit was within a given date range. This could be useful for other purposes besides inactivating records:
SET @pos=0, @FromDate='2006-01-01' , @ToDate='2007-01-01';
SELECT pa.ChartNumber, pa.LName, pa.FName, MAX(ProcDate) AS 'Last Seen'
FROM patient pa, procedurelog pl
WHERE pl.PatNum = pa.PatNum
AND pa.patstatus = '0'
AND pl.procStatus IN(2,3)
GROUP BY pl.PatNum
HAVING (MAX(ProcDate) BETWEEN @FromDate
AND @ToDate)
ORDER BY pa.Lname;
Jorge Bonilla, DMD
Query to select patients by date last visit
Query to select patients by date last visit
Jorge Bonilla DMD
Open Dental user since May 2005
Open Dental user since May 2005