Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi,
I do not understand where it can be the error. Could you help me?
Thanks
Fabio M.
[SCADENZIARIO]:
LOAD
SCADUTIOLTRE120
SCADUTI120
SCADUTI90
SCADUTI60
SCADUTI30
ASCADERE30
ASCADERE60
ASCADERE90
ASCADERE120
SQL SELECT
year(XLSCAD)*100+Month(XLSCAD) "Annomese",
case
when XLSCAD < (current date - 5 month) then "SCADUTIOLTRE120"
when XLSCAD < (current date - 4 Month) then "SCADUTI120"
when XLSCAD < (current date - 3 month) then "SCADUTI90"
when XLSCAD < (current date - 2 month) then "SCADUTI60"
when XLSCAD < (current date - 1 month) then "SCADUTI30"
when XLSCAD > (current date + 1 month) then "ASCADERE30"
when XLSCAD > (current date + 2 month) then "ASCADERE60"
when XLSCAD > (current date + 3 month) then "ASCADERE90"
when XLSCAD > (current date + 4 month) then "ASCADERE120"
else 0
END
"SCAGLIONI",
....
Hi,
I think i understand your logic.
Try this:
[SCADENZIARIO]:
LOAD
SCADUTIOLTRE120,
SCADUTI120,
SCADUTI90,
SCADUTI60,
SCADUTI30,
ASCADERE30,
ASCADERE60,
ASCADERE90,
ASCADERE120,
...
...;
SQL SELECT
year(XLSCAD)*100+Month(XLSCAD) "Annomese",
case when XLSCAD < (current date - 5 month) then 1 else 0 end as "SCADUTIOLTRE120",
case when XLSCAD >= (current date - 5 month) and XLSCAD < (current date - 4 Month) then 1 else 0 end as "SCADUTI120",
case whenXLSCAD >= (current date - 4 month) and XLSCAD < (current date - 3 month) then 1 else 0 end as "SCADUTI90",
case when XLSCAD >= (current date - 3 month) and XLSCAD < (current date - 2 month) then 1 else 0 end as "SCADUTI60",
case when XLSCAD >= (current date - 2 month) and XLSCAD < (current date - 1 month) then 1 else 0 end as"SCADUTI30",
case when XLSCAD >= (current date -1 month) and XLSCAD < (current date + 1 month) then 1 else 0 end as"ASCADERE30",
case when XLSCAD >= (current date + 1 month) and XLSCAD < (current date + 2 month) then 1 else 0 end as"ASCADERE60",
case when XLSCAD >= (current date + 2 month) and XLSCAD < (current date + 3 month) then 1 else 0 end as"ASCADERE90",
case when XLSCAD >= (current date + 3 month) then 1 else 0 end as"ASCADERE120",
....
....;
you have to verify the intervals for XLSCAD
hi Xavier,
great job.
Perfect! It's works.