Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 The multi-part identifier could not be bound

Author  Topic 

tariq2
Posting Yak Master

125 Posts

Posted - 2011-10-06 : 06:56:01
Hi,
in the following I am trying to update
the AOT value in cte1 with the faotaot value in cte2.
Unfortunately I receive ' The multi-part identifier cte1.faotaot could not be bound'
Many thanks in advance

with cte1 as
(
select JobKey,SUM(aot) as faotaot from F_AOT where PeriodKey <=96
AND PeriodKey >=85 AND BUKey in
(select bukey from d_businessunits where TerritoryName = 'France' AND YEAR = '2010')
AND LedgerKey = 20
group by jobkey

)
,cte2 as
(
select * from F_AOGM where PeriodKey = 96 AND JobKey IN
(select JobKey from D_JobAttributes where BUKey in
(select bukey from d_businessunits where TerritoryName = 'France'))
)
update cte2
set cte2.AOT = cte1.faotaot
from cte1 a inner join cte2 b
on a.JobKey = b.JobKey

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-10-06 : 07:05:24
quote:
Originally posted by tariq2

Hi,
in the following I am trying to update
the AOT value in cte1 with the faotaot value in cte2.
Unfortunately I receive ' The multi-part identifier cte1.faotaot could not be bound'
Many thanks in advance

with cte1 as
(
select JobKey,SUM(aot) as faotaot from F_AOT where PeriodKey <=96
AND PeriodKey >=85 AND BUKey in
(select bukey from d_businessunits where TerritoryName = 'France' AND YEAR = '2010')
AND LedgerKey = 20
group by jobkey

)
,cte2 as
(
select * from F_AOGM where PeriodKey = 96 AND JobKey IN
(select JobKey from D_JobAttributes where BUKey in
(select bukey from d_businessunits where TerritoryName = 'France'))
)
update b
set AOT = a.faotaot
from cte1 a inner join cte2 b
on a.JobKey = b.JobKey





No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

tariq2
Posting Yak Master

125 Posts

Posted - 2011-10-06 : 07:11:56
Thank you webfred :)
Go to Top of Page
   

- Advertisement -