Help. Can't figure this out. These queries *should* operate on the same number of rows but they don't:
Code:
-- updates 2 rows
begin tran
UPDATE t1
SET t1.IndustryCode = t3.Industry
FROM IndustryTable t1
JOIN CompanyTable t2
ON t1.IndustryID = t2.IndustryID
JOIN CorrectTable t3
ON t2.CompanyCode = t3.Symbol
WHERE t1.IndustryCode <> t3.Industry
rollback
-- updates 35 rows!
SELECT
t1.IndustryCode,
t3.Industry
FROM IndustryTable t1
JOIN CompanyTable t2
ON t1.IndustryID = t2.IndustryID
JOIN CorrectTable t3
ON t2.CompanyCode = t3.Symbol
WHERE t1.IndustryCode <> t3.Industry
And I can't figure out what I'm doing wrong here.
Thanks