I have this query below and it is giving me the error msg:
Invalid Column dame 'Retur_Date'. I know it is in the insert statement, but don't know why Here it is:
create table #Merge1 (
[Model_No] [nvarchar] (50) NULL ,
[Return_Date] DateTime,
[QtyRet] int not null default (0),
[QtyPrd] int not null default(0),
[Month_No] int not null default(0)
)
-- get the production data
insert into #Merge1 (
Model_No,
Return_Date,
QtyRet,
QtyPrd,
Month_No
)
select
a.Model_No,
a.Ret_Date,
a.QtyRet,
(
Select
sum([QtyPrd])
From
#Prod1
where
Build_Date <= a.Ret_Date
) as QtyPrd,
a.Month_No
from
#Return1 a
order by
a.Ret_Date
Thanks,
Invalid Column dame 'Retur_Date'. I know it is in the insert statement, but don't know why Here it is:
create table #Merge1 (
[Model_No] [nvarchar] (50) NULL ,
[Return_Date] DateTime,
[QtyRet] int not null default (0),
[QtyPrd] int not null default(0),
[Month_No] int not null default(0)
)
-- get the production data
insert into #Merge1 (
Model_No,
Return_Date,
QtyRet,
QtyPrd,
Month_No
)
select
a.Model_No,
a.Ret_Date,
a.QtyRet,
(
Select
sum([QtyPrd])
From
#Prod1
where
Build_Date <= a.Ret_Date
) as QtyPrd,
a.Month_No
from
#Return1 a
order by
a.Ret_Date
Thanks,