question from:https://stackoverflow.com/questions/66060121/postgressql-calculate-daily-costI want to work out daily cost for each advert based on number of days it's running. Also to show days in the period from the start to end. in dataset I have 5 columns for a media campaign. Col A Id eg A001 Col B Advert Col C Cost eg 300 Col D startdate eg 01-01-2021 Col E enddate eg 30-01-2010 For this record enddate is 30 days after startdate What I want
- Create 30 rows from that 1 row of data
- Each row to repeat details for Col A to Col E
- Col F to show all the days from start to end row 1 is startdate row 2 is startdate plus 1 day row 3 is startdate plus 2 days and so on until row 30 is enddate
- Then col F have 30 rows based on cost divided by number of rows which is 30 in this case row 1 is 10 which is 300 divided by 30 row 2 is 10 and so on to row 30 which is 10