By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
4 rows affected
| product | quantity | total | needed |
|---|---|---|---|
| Product 1 | 300 | 1000.0 | 750.000000 |
| Product 2 | 200 | 1000.0 | 1000.000000 |
| Product 3 | 200 | 1000.0 | 1000.000000 |
| Product 4 | 300 | 1000.0 | 750.000000 |
| quantity | total | current_percent | target_percent | needed |
|---|---|---|---|---|
| Product 1 | 1000.0 | 0.30000000000000 | 0.35 | 76.923076 |
| Product 2 | 1000.0 | 0.20000000000000 | 0.35 | 230.769230 |
| Product 3 | 1000.0 | 0.20000000000000 | 0.35 | 230.769230 |
| Product 4 | 1000.0 | 0.30000000000000 | 0.35 | 76.923076 |