Hi Delerma
Thanks for the reply, Is this query still going to work for a dataset of records. I need for lines x to y to be minus-ed from the previous months lines x to y?
Just looking at the code it seems that you are saying that it is just this month's 1 line minus last month's 1 line?...
User Profile
Collapse
-
Hi, let me try and give all the details, but what I really want is to subtract a dataset (dataset, i.e. line 129 to line 150, for month 11, columns 1 to 12)
from the previous months dataset (i.e. month 10)
Example
Line Month Column1 Column2 Column3 Column99
129 11 9,700 4,000 4,600 6,300
130 11 7,800 8,300 1,500 3,900
131 11 4,400 4,500 6,000 7,100
132 11 500 8,600...Leave a comment:
-
Thanks for the help, I sort off thought that the only solution would be to use dymanic SQL.
Regards
ChrisLeave a comment:
-
using a variable in the column_alias of a select
Is there a way of doing the following
DECLARE @1 AS VARCHAR(200)
SET @1 = (SELECT COLDESC FROM DIM_ROWCOL_NEW WHERE COLNR = 1 AND ROWNR = 129)
SELECT COL1 as @1, ....
I dont want to set the column_alias to a set value, but rather select what ever is in the lookup table (Dim_rowCol_New ).
Any ideas on this will help
Thanks -
It would basically be a table with the structure
[#Year] char(4),
[#MonthNr] char(2),
[#RowNr] decimal(3, 0),
[#Column01] decimal(20, 4),
[#Column02] decimal(20, 4) ,
.....
.....
.....
With data for MonthNr 1 to 12 for the year.
i.e.
"2007", "10", 129, 1234.00, 4321.00
"2007", "11",...Leave a comment:
-
Maybe something very easy?
Hi
I've got a table with the following
MonthNr
ColumnNr
RowNr
Column01
......
Column12
I want to calc the movements between this month and last month
Can this be done in 1 sql statement?
I want to select * from table where monthnr = 11 and rownr between 1 and 10
"minus" select * from table where monthnr = 10 and rownr between 1...
No activity results to display
Show More
Leave a comment: