Sno ECTCodeDescription ECTHedisCodeTypeCode
1 Outpatient CPT
2 Outpatient RevCode
3 Nonacute inpatient CPT
4 Nonacute inpatient RevCode
5 ED CPT
6 ED RevCode
7 Acute inpatient CPT
8 Acute inpatient RevCode
在这里我得到这样的结果,我的查询是
SELECT
DISTINCT Sno = ROW_NUMBER() OVER (
ORDER BY ECTCodeDescription DESC
),
EC.ECTCodeDescription,
CEC.ECTHedisCodeTypeCode
FROM CodeSetHEDIS_ECTCode EC
INNER JOIN CodeSetECTHedisCodeType CEC
ON EC.ECTHedisCodeTypeID = CEC.ECTHedisCodeTypeID
WHERE ECTHedisTableID = 29
GROUP BY ECTCodeDescription,
CEC.ECTHedisCodeTypeCode
我怎样才能得到这样的输出:
Sno CODEName CODEID
1 Outpatient NULL
2 CPT 1
3 RevCode 1
4 Nonacute NULL
5 CPT 4
6 RevCode 4
7 ED NULL
8 CPT 7
9 RevCode 7
10 Acute inpatient NULL
11 CPT 10
12 RevCode 10
您可以观察 CPT = 1 和 Revcode = 1 的门诊 ID = 1 和 CPT = 4 和 Revcode = 4 的非急性 ID = 4
建议我的方式