I am trying to create a aging report using SQL.
I'm trying to grab the balance for all customers who had a invoice due in the previous month. So if it's March, then I want to show all the balances for invoices that were due in February.
This is what I came up with, but I keep getting 0 for the Customers that I know have balances in the month of February.
SELECT arar_cust_n, arar_due_date,
case
when arar_due_date = Month(DATEADD(mm, -1, GETDATE()))
then arar_balance
else 0
End as thirtydaypassed
from arar
Please help.
Open in new window
Saurabh...