From today's date, how to display last 10 years
Posted on February 28, 2018 at 7:24pm
I tried to do as much as I can in query, but when there are no records for corresponding year, year does not display. But I would like the year to still display with a zero beside it. So thought if there was a way, based from the
start date and end date, display current year and each year before that, no more than 10.
Joined: Jan 11 2017 - 7:59am
Last seen: 2 years 1 month ago
Posted on March 2, 2018 at 3:06pm
Try using this query if you are using Oracle
select trunc(extract(year from sysdate) - 0) + level - 10 as business_date
from dual
connect by extract(year from sysdate) + level - 1 <
extract(year from sysdate) + 10
Joined: Oct 12 2015 - 12:05pm
Last seen: 9 months 2 weeks ago
Posted on March 5, 2018 at 5:24am
Thanks so much for your help, but looks like I'm missing something. I get the following error:
"invalid relational operator"
Joined: Jan 11 2017 - 7:59am
Last seen: 2 years 1 month ago
Posted on March 6, 2018 at 12:46pm
Be sure to maintain the same relational operators.. the same code works for me.
Joined: Oct 12 2015 - 12:05pm
Last seen: 9 months 2 weeks ago
Posted on April 2, 2018 at 7:01am
That works! thanks so much reportdev! :)
Joined: Jan 11 2017 - 7:59am
Last seen: 2 years 1 month ago