Hello All,
Please help me with the SQL Query.
The table structure is:
EffectiveDate Amount
08/31/2008 400
09/30/2008 350
10/31/2008 200
11/30/2008 500
12/31/2008 100
I want to find the difference between any two rows provided the effective date.
For example: If @Month=11/30/3008 then i want the output of the stored procedure to be like
Year Month Quarter
500 300 150
i.e for year it has to display the Amount for the @Month(11/30/2008)
for month it has to display the difference of Amount for 11/30/2008 and 10/31/2008 (500-200)
for Quarter it has to display the difference of Amount for 11/30/2008 and 09/30/2008. (500-350)
Can somebody help me with the logic for this.
Please help me with the SQL Query.
The table structure is:
EffectiveDate Amount
08/31/2008 400
09/30/2008 350
10/31/2008 200
11/30/2008 500
12/31/2008 100
I want to find the difference between any two rows provided the effective date.
For example: If @Month=11/30/3008 then i want the output of the stored procedure to be like
Year Month Quarter
500 300 150
i.e for year it has to display the Amount for the @Month(11/30/2008)
for month it has to display the difference of Amount for 11/30/2008 and 10/31/2008 (500-200)
for Quarter it has to display the difference of Amount for 11/30/2008 and 09/30/2008. (500-350)
Can somebody help me with the logic for this.