Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have "years of service" column in my database with value for eg 4.34. How do i calculate the service date?
Logically it should be Date(Today() - "years of service")
But can someone help me write exact expression in load script.
Thanks
I believe something like this should work:
SELECT Years_of_Service,
Date(Today()-Years_of_Service*365.25) as Service_Date
FROM YourTable;
You can test it with this:
LOAD Years_of_Service,
Date(Today()-Years_of_Service*365.25) as Service_Date
INLINE [
Years_of_Service
2.34
4.34
];
please post some sample values and your expecetd result.
It's not quite clear, how the fractional year part is calculated in the first place. There might be different methods (fixed number of days per year vs. considering leap years...)
thanks
regards
Marco