Hi,
Try adding this as another column to your select list.
SELECT TOP 1 crs.NO_REFERRALS
FROM #CRS_REFERRALS1 AS xcrs
FULL OUTER JOIN #CRS_REFERRALS1 AS xcrsx ON xcrs.HOSP_CODE = xcrsx.HOSP_CODE AND xcrs.MONTH = DATEADD(MONTH,1,xcrsx.MONTH)
WHERE crs.HOSP_CODE=xcrs.HOSP_CODE
ORDER BY DATEADD(DAY,1-DATEPART(DAY,crs.MONTH),CONVERT(date,crs.MONTH)) AS [MONTH] DESC
Regards,
Gavin Clayton Claytabase Ltd www.claytabase.co.uk
No comments:
Post a Comment