June 21, 2007 at 11:49 pm
I have the following query, which when run returns that DimSalesrep (on the UPDATE line) is ambiguous. I know I've included it a few times but I've aliased it everywhere else. I've tried qualifying the name of the table as well, back to the database level. Any ideas?
-----------
UPDATE DimSalesRep
SET DimSalesRep.national_manager_id = DSR3.salesrep_id
FROM DimSalesrep Mgr LEFT OUTER JOIN DimSalesrep DSR2
ON Mgr.manager_id = DSR2.salesrep_id LEFT OUTER JOIN MudgeeLiv_App.dbo.dept dept
ON DSR2.department = dept.dept LEFT OUTER JOIN DimSalesrep DSR3
ON LTRIM(RTRIM(dept.mgr_num)) = LTRIM(RTRIM(DSR3.code))
GO
June 22, 2007 at 12:19 am
UPDATE Mgr
SET national_manager_id = DSR3.salesrep_id
FROM DimSalesrep Mgr
LEFT OUTER JOIN DimSalesrep DSR2 ON Mgr.manager_id = DSR2.salesrep_id
LEFT OUTER JOIN MudgeeLiv_App.dbo.dept dept ON DSR2.department = dept.dept
LEFT OUTER JOIN DimSalesrep DSR3 ON LTRIM(RTRIM(dept.mgr_num)) = LTRIM(RTRIM(DSR3.code))
June 22, 2007 at 12:26 am
Thanks, worked a treat. Makes sense when you think about it
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply