Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
could you help me?
Wrong is the bold line.
SQL SELECT
GETDATE () AS "Data Giorno",
year("xlscad")*100+Month("xlscad") "Annomese",
case
when xlscad < ("Data Giorno" - 4 Month - 1 day)
then 'SCADUTO DA OLTRE 120'
when xlscad between (current_date - 4 Month) and (current_date - 3 Month - 1 day)
then 'SCADUTO DA 120'
WHEN xlscad between (current_date - 3 month) and (current_date - 2 Month - 1 day)
then 'SCADUTO DA 90'
WHEN xlscad between (current date - 2 Month) and (current_date - 1 month - 1 day)
then 'SCADUTO DA 60'
when xlscad between (current_date -1 month) and (current_date)
then 'SCADUTO DA 30'
when xlscad between (current_date) and (current_date + 1 month)
then 'A SCADERE A 30'
when xlscad between (current_date + 1 Month + 1 day) and (current_date + 2 month)
then 'A SCADERE A 60'
when xlscad between (current_date + 2 month + 1 day) and (current_date + 3 month)
then 'A SCADERE A 90'
when xlscad between (current_date + 3 month + 1 day) and (current_date + 4 month)
then 'A SCADERE A 120'
when xlscad > (current_date + 4 month + 1 day)
then 'A SCADERE OLTRE 120'
Else
'ZERO'
END
"SCAGLIONI"
Hi Clever,
i'm out of office but your reply seems good.
I had already found a similar statement.
I'll test it this afternoon.
OK it works.
Many thanks.