SELECT DISTINCT
'CPT_Code' = CPT.CPT_Code
,'CPT_Short_Description' = CPT.CPT_Short_Desc
,'CPT_Code_Description' = CONVERT(VARCHAR(MAX), CPT.CPT_CODE) + ' - ' + CPT.CPT_Short_Desc
FROM dbo.FACT_ProCharge AS FACT WITH (NOLOCK)
INNER JOIN dbo.DIM_Treatment CPT WITH (NOLOCK) ON FACT.TreatmentKey = CPT.TreatmentKey
INNER JOIN dbo.DIM_Date SERVDATE WITH (NOLOCK) ON FACT.ServiceDateKey = SERVDATE.DateKey
WHERE FACT.BillServiceAreaKey = (SELECT MIN(BillServiceAreaKey) FROM dbo.DIM_BillServiceArea WITH (NOLOCK) WHERE SERV_AREA_ID = '14')
AND SERVDATE.SQL_Date BETWEEN @StartDate AND @EndDate
AND CPT.CPT_Level_1_Name <> 'Evaluation and Management Services' --No E&M
AND CPT.CPT_CODE <> '99024' --No post-op visit
AND CPT.CPT_CODE NOT BETWEEN '80000' AND '89999' --No Lab codes
ORDER BY CPT_Code
将datetime参数传递给@StartDate和@EndDate后,它不会返回任何结果。 如果我在where子句中注释掉INNER JOIN DIM_Date和日期范围,它将返回我想要的cpt_codes。
查询在Management studio中运行,并且需要输出。
我该怎么办?
答案 0 :(得分:0)
我是一个新手,但我只是试图解决你的问题。如果这对你有帮助我会很开心
SERVDATE.SQL_Date&gt; = @StartDate AND SERVDATE.SQL_Date&lt; = @EndDate
由于