Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- List of patients with specific procedure code(s) completed. Provided by Divergent Dental Resources, LLC.
- -- Procedure code(s) defined on line 23.
- SET
- @FromDate = CURDATE() - INTERVAL 12 MONTH, -- Defaults to previous 12 months. Change start date to define range.
- @ToDate = CURDATE();
- SELECT
- CONCAT(p.LName, ', ',p.FName, ' ', p.MiddleI) As Patient,
- p.Email,
- pl.ProcDate,
- pv.Abbr,
- pc.ProcCode,
- pc.AbbrDesc,
- ToothNum,
- pl.ProcFee
- FROM patient p
- INNER JOIN procedurelog pl ON p.PatNum = pl.PatNum
- INNER JOIN procedurecode pc ON pl.CodeNum = pc.CodeNum
- INNER JOIN provider pv ON pl.ProvNum = pv.ProvNum
- WHERE
- pl.ProcStatus = 2
- AND pl.ProcDate >= @FromDate
- AND pl.ProcDate <= @ToDate
- AND pc.ProcCode IN ('D6010') -- List desired procedure codes here. Enclose each code with single quotes, separate by comma, and contained within the parentheses. Example: ('D8080','D8090')
- ORDER BY
- p.LName,
- p.FName;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement