C
CuriousMark
I have a database that records encounters with patients, showing the
procedures done (CPT codes). Each CPT is associated with a value (RVU) in a
separate table. I want to extract the CPT for each encounter that has the
highest RVU. This database is protected within an HIPAA compliant network.
There are two tables involved:
tblEncCPT
EncCPTID - primary key
EncID - foreign key from tblEncounter
CPT - foreign key from tblRVU
tblRVU
CPT - primary key
WorkRVU - number
I can construct a query that gives me this:
EncID CPT RVU
4 32663 24.56
4 38746 4.88
4 31622 2.78
4 64421 1.68
6 32651 18.7
6 31622 2.78 ...
SELECT tblEncCPT.EncID, tblEncCPT.CPT, tblRVU.RVU
FROM tblRVU INNER JOIN tblEncCPT ON tblRVU.CPT=tblEncCPT.CPT
ORDER BY tblEncCPT.EncID, tblRVU.RVU DESC;
But I can't figure out how to get to this:
EncID CPT
4 32663
6 32651 ...
Thanks for your help.
procedures done (CPT codes). Each CPT is associated with a value (RVU) in a
separate table. I want to extract the CPT for each encounter that has the
highest RVU. This database is protected within an HIPAA compliant network.
There are two tables involved:
tblEncCPT
EncCPTID - primary key
EncID - foreign key from tblEncounter
CPT - foreign key from tblRVU
tblRVU
CPT - primary key
WorkRVU - number
I can construct a query that gives me this:
EncID CPT RVU
4 32663 24.56
4 38746 4.88
4 31622 2.78
4 64421 1.68
6 32651 18.7
6 31622 2.78 ...
SELECT tblEncCPT.EncID, tblEncCPT.CPT, tblRVU.RVU
FROM tblRVU INNER JOIN tblEncCPT ON tblRVU.CPT=tblEncCPT.CPT
ORDER BY tblEncCPT.EncID, tblRVU.RVU DESC;
But I can't figure out how to get to this:
EncID CPT
4 32663
6 32651 ...
Thanks for your help.