I have a database table month_values
this table has 12 columns...... columns are jan , feb , march , .....decm.
I have data values for each months.
I'm writing store procedure. I want to sum values between any two input month columns.
Example Input :
output for the above stored procedure should be sum values for month columns feb,march,april,may,june,july,aug,sept.
my problem is ...As you can see this is going to be dynamic query....because we may pass any two month columns to the store procedure input.
Can you please suggest how to build dynamic query here based on input selection ?
Do I need to use a CASE here ? how do I proceed ?