why do you need case when here? i think this is enoughSELECT Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo,Dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date,case when DATEDIFF(month,dim_Outlet.Open_Date,Audit_FDMS_Billing_Fees_Hist.fee_wholesale_date) AS DiffDate FROM Audit_FDMS_Billing_Fees_Hist INNER JOIN Dim_Outlet ON Audit_FDMS_Billing_Fees_Hist.FDMSAccountNo = Dim_Outlet.FDMSAccountNowhere fee_sequence = '32r'order by FDMSAccountNo
------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs