i'm using sql server 2005 for my asp.net program.
i have 2 tables, first table X, second table Y
X has column:
DEM_ID int
DEM_DATE datetime
DEM_QTY numeric(18,0)
constraint PK_DEMAND primary key nonclustered (DEM_ID)
Y has column:
FRC_ID int
FRC_YEAR numeric(4)
FRC_MON numeric(2)
FRC_SALES numeric(18,0)
FRC_FRCSALES numeric(18,0)
FRC_FRCLOG numeric(18,0)
constraint PK_FORECASTSALES primary key nonclustered (FRC_ID)
What i want to do is put each month and year from col dem_date in table X to col frc_year and frc_mon in table Y and put sum dem_qty per mon and year to frc_sales. and then get frc_frcsales row values from calculation (e.g for row 90 = (4*89th row in col frc_sales)+(6*84th row in col frc_sales+....), for row 91 =(4*90th row in col frc_sales)+(6*85th row in col frc_sales+....) ) and continues everytime i had new row on table X.
Best Regards & Thanks.