Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
SELECT @datStart, @datStop -- DROP TABLE #TEMP_ACCT DROP TABLE #TEMP_AVG SELECT DISTINCT ACCT_NO INTO #TEMP_ACCT FROM data8.dbStPetes.dbo.tblHEAD WHERE (ISNULL(DISCHARGE,ADMIT) >= @datStart) AND (ISNULL(DISCHARGE,ADMIT) <= @datStop) SELECT DISTINCT DEPT_CODE, PROC_CODE, CASE WHEN ISNULL(SUM(QTY),0) = 0 OR ISNULL(SUM(REV),0) =0 THEN 0 ELSE SUM(REV)/SUM(QTY) END AS AVGREV INTO #TEMP_AVG FROM data8.dbStPetes.dbo.tblTRANS WHERE ACCT_NO IN(SELECT ACCT_NO FROM #TEMP_ACCT) GROUP BY DEPT_CODE, PROC_CODE
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.