Forum Discussion
Andregewehr
Helper I
4 years agoSum based on accumulated values
Hi people! I have the following table with id_product, date, sells and available_minutes. Every day the database is updated, to check how many sells the product was for sale. The available_minute...
Andregewehr
Helper I
4 years agoSorry,
For the id_product (1) and for each period, I want the following sum of sells:
- If accumulate minutes <= 10080, sum sells = 10
- If accumulate minutes <= 20160, sum sells = 22
| id_product | accumulate_minutes | sum_sells |
| 1 | 10080 | 10 |
| 1 | 20160 | 22 |