0

I have a column- amount.

I need to split this into 5 and show it for the next 5 years.

Example:

If the amount is 1000, I need to split it equally into 5 and show it for the following 5 years.

Like 1000/5 and the answer should be

 2018-200, 2019-200, 2020-200, 2021-200, 2022-200.

How can this be done in Mysql?

Strawberry
  • 33,750
  • 13
  • 40
  • 57
  • 1
    See https://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql-query – Strawberry Nov 12 '18 at 23:44
  • Hi Asha, I think that if you can repeat the rows you should be able to do the rest with a query, try this stack overflow question and answer https://stackoverflow.com/questions/10423767/sql-repeat-a-result-row-multiple-times-and-number-the-rows – MikeAinOz Nov 13 '18 at 00:13
  • 1
    [is storing a delimited list ina database column really that bad?](https://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad) – Barmar Nov 13 '18 at 01:20
  • What if it can't be split equally, e.g. 999/5? Do you want 199.8 or 4*200 and 199? – dnoeth Nov 13 '18 at 07:04

0 Answers0