Hi,
I want to know whether is this possible in SQL?
I need to create "Calculation_Required" as a calculation for data below showcased:
week Store_id Item_id Promo_id Quantity Calculation_Required
20 101 355 22501 7 "=7/7+3"
20 101 355 0 3 0
21 101 356 0 5 0
21 101 356 35621 10 "=10/5+10+4"
22 101 356 42016 4 "=4/5+10+4"
23 101 358 96421 9 "=9/9+4"
23 101 358 0 4 0
25 101 359 25694 6 "=6/6+12"
25 101 359 0 12 0
26 101 360 36992 5 "=5/5+8"
26 101 360 0 8 0
Note:
If Promo_id is "0" then Calculation_Required is also "0".
If Promo_id is having value (Ex:22501) then calculation_Required is calculated as above shown table.
Thanks,
Ganesh K