I have a table that shows an amount for a specific start and end date similar to this table:
ID |start_date |end_date |amount
---|------------|-----------|-------
a1 |2019-01-01 |2019-01-05 |100
---|------------|-----------|-------
a2 |2019-01-01 |2019-01-10 |100
And I'm trying to generate a table in SQL that divides out the amount by days between start and end date. For example:
ID |date |splitamount
---|------------|-------
a1 |2019-01-01 |20
---|------------|-------
a1 |2019-01-02 |20
---|------------|-------
a1 |2019-01-03 |20
---|------------|-------
a1 |2019-01-04 |20
---|------------|-------
a1 |2019-01-05 |20
---|------------|-------
a2 |2019-01-01 |10
---|------------|-------
a2 |2019-01-02 |10
---|------------|-------
a2 |2019-01-03 |10
---|------------|-------
a2 |2019-01-04 |10
---|------------|-------
a2 |2019-01-05 |10
---|------------|-------
a2 |2019-01-06 |10
---|------------|-------
a2 |2019-01-07 |10
---|------------|-------
a2 |2019-01-08 |10
---|------------|-------
a2 |2019-01-09 |10
---|------------|-------
a2 |2019-01-10 |10