Page 1 of 1
query help
Posted: Wed Nov 09, 2016 6:12 am
by sam-I-am
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
Re: query help
Posted: Wed Nov 09, 2016 8:11 am
by cmcgehee
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
Posted: Wed Nov 09, 2016 9:07 am
by rhaber123
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
Re: query help
Posted: Wed Nov 09, 2016 1:25 pm
by Tom Zaccaria
You may want to try query #1184
drtmz
Re: query help
Posted: Thu Nov 17, 2016 3:31 am
by sam-I-am
Thanks to all...#1184 was just what I wanted. But I still have to learn how to write these things myself! Sam Barr
Re: query help
Posted: Thu Nov 17, 2016 8:15 am
by Tom Zaccaria
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