Is there a query out there for number of each procedure performed over a given length of time? I'm pretty much retarded when it comes to writing sql queries. Yes I know I need to learn
Sam Barr
query help
Re: query help
You can use the built-in Daily Procedures report and group it by procedure code. This will tell you the number of procedures completed for the chosen time frame. If you need a twist on this report, let me know what it is, and I'll see if I can find it on the Query Examples page.
Re: query help
Top 100 procedures during a certain period of time:
===============================================
SET @FromDate='2016-01-01' , @ToDate='2016-12-31';
SELECT Count(*),pv.Abbr, pc.ProcCode, pc.AbbrDesc, AVG(pl.ProcFee) as '$Ave. Fee' , SUM(pl.ProcFee) AS '$Tot. Prod' FROM patient
INNER JOIN procedurelog pl ON patient.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)
GROUP BY pc.ProcCode
ORDER BY Count(*)DESC Limit 100
===============================================
SET @FromDate='2016-01-01' , @ToDate='2016-12-31';
SELECT Count(*),pv.Abbr, pc.ProcCode, pc.AbbrDesc, AVG(pl.ProcFee) as '$Ave. Fee' , SUM(pl.ProcFee) AS '$Tot. Prod' FROM patient
INNER JOIN procedurelog pl ON patient.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)
GROUP BY pc.ProcCode
ORDER BY Count(*)DESC Limit 100
-
- Posts: 356
- Joined: Mon Feb 25, 2008 3:09 am
Re: query help
You may want to try query #1184
drtmz
drtmz
Re: query help
Thanks to all...#1184 was just what I wanted. But I still have to learn how to write these things myself! Sam Barr
-
- Posts: 356
- Joined: Mon Feb 25, 2008 3:09 am
Re: query help
No need. There are almost 1200 examples on the query page to fit most needs. Usually you can cobble something from the examples. If not, post to this group for added guidance.
drtmz
drtmz