I have a problem this is my table item
Item |Begin | in01 | in02 | ..| in12 | out01 | out02 |..|out12 | Balance
A | 100 | 10 | 20 | ..| 10 | 5 | 10 |..| 5 | 110
item A have begin qty 100 at first month, and balance qty at month 12 = 110 balance updating every month
i need to call a procedure to get data for every month report
sample for report for month 01
Beginning| In | Out | balance
100 | 10 | 5 | 105
sample for report for month 02
Beginning| In | Out | balance
105 | 20 | 10 | 115
sample for report for month 12
Beginning | In | Out | balance
balance month 11 | xx | xx | 11 + in - out
so beginning value = balance last month any way to make this stored procedure simple? not using a lot of 'IF'
it's better using case ?
need some idea.. thanks
u can used Case statement to avoid the if statement
select
case when beginning value = balance then 1st Option else 2nd Option as Test
from tblTest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With