kevinrossen

Patients Deactivated Past 12 Months

Jan 29th, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.39 KB | None | 0 0
  1. -- Patients deactivated in the past 12 months
  2. SELECT
  3.     p.LName,
  4.     p.FName,
  5.     sl.`LogDateTime`,
  6.     sl.`LogText`,
  7.     sl.`CompName`
  8. FROM securitylog sl
  9. INNER JOIN patient p ON sl.PatNum = p.PatNum
  10. WHERE
  11.     sl.LogText LIKE "Patient status changed from 'Patient' to%"
  12.     AND DATE(sl.LogDateTime) >= CURDATE() - INTERVAL 12 MONTH  -- Limit results to previous 12 months
  13. ORDER BY
  14.     LogDateTime DESC
  15. ;
Advertisement
Add Comment
Please, Sign In to add comment