Skip to content
Advertisement

How to get all years between a range of begin and end date in sql oracle

I have a table evaluations like this

enter image description here

I want to convert the bgn_year and end_year into a eval_year by enumerate all years between the two ranges. the result would look like this:

enter image description here

I tried with a connect by:

But I have to many duplicated rows. I can add a distinct, but I don’t think that is the way to do it.

Advertisement

Answer

That would be something like this (sample data in lines #1 – 7; query you need begins at line #8):

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement