Unanswered: Calculating patient days for prior month
I am very rusty on my SQl and struggling with this one.
Need my patient day calculation to count number of days in the past month. My current query is calculating total patient days.
Any help is appreciated.
DATEDIFF(DAY,adm_ts,isnull(dschrg_ts,DATEADD(MONTH , DATEDIFF(MONTH, -1, GETDATE())-1, -1))) as 'Total Patient Days'