This simple query tells you how many patients have charge entries in their ledgers between two dates.
The keyword DISTINCT in the COUNT() function eliminates duplicates.
Select All Code:
1 2 3 4 5 6 7 8 | SELECT COUNT(DISTINCT ptnum) FROM journal WHERE trantype = 'S' AND amount > 0 AND trandate BETWEEN '2004-01-01' AND '2004-12-31' |
Here’s a variation using the rv_charges view that breaks down the patient count by rendering provider. In
this case, we use rv_charges as an easy way to get to the provider code associated with the charges:
Select All Code:
1 2 3 4 5 6 7 8 9 10 | SELECT provcode AS "Provider", COUNT(DISTINCT ptnum) AS "Clients Seen" FROM rv_charges WHERE amount > 0 AND trandate BETWEEN '2004-01-01' AND '2004-12-31' GROUP BY provcode |
