Skip to Main Content

SQL & PL/SQL

Display YEARS between two dates

A.Mohammed RafiMar 17 2010 — edited Mar 17 2010
Dear Reader,

There are two requirements for which I need you help.

Requirement 1:

Based on the from and to date the years should be displayed.

For example the from date is 01-JAN-07 and end date is 31-SEP-10 the query should return as follows :

2007
2008
2009
2010

Requirement 2 :

For example the from date is 01-JAN-07 and end date is 31-FEB-08 the query should return as follows :

2007-Quarter1
2007-Quarter2
2007-Quarter3
2007-Quarter4
2008-Quarter1
2008-Quarter2
2008-Quarter3
2008-Quarter4

Kindly help in providing the soltuion.

Regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 14 2010
Added on Mar 17 2010
10 comments
28,855 views