>>>>>>I was so used to flip that around in VFP!
>>>>>
>>>>>Hmm, never tried flipping it around in VFP either. BTW, pay attention to other changes I made in your query.
>>>>
>>>>Great, it's working good, and fast. Problem was that originally I had a scan doing the updates in Business objects and posting one by one, and that took too long, so I had to do a direct query to update all at once.
>>>
>>>I am not sure why do you need inner join here. Why not just:
>>>
>>>UPDATE EmpItems ;
>>>SET itOnPosted = 1, ;
>>>itBalAmt = HistItems.itBalNew + HistItems.itPostCalc;
>>>FROM HistItems where HistItems.eiKey = EmpItems.eiKey and HistItems.DelFlag = 0
>>>
>>
>>This is not going to work. HistItems is a different table so you must join with it.
>
>You have any working strand alone example that supports it? Then show it to me.
Intrerestingly - I realized it was a disguised JOIN (using WHERE clause). It is hard to understand (IMHO), but it works:
use tempdb
create table EmpItems(itOnPosted int, itBalAmt int, eiKey int primary key)
insert into EmpItems (eiKey) values (1),(2),(3)
declare @HistItems table (itBalNew int, itPostCalc int, DelFlag bit default 0, eiKey int)
insert into @HistItems (itBalNew, itPostCalc, eiKey)
values (10, 20, 1), (15, 14, 2), (25, 12, 3)
UPDATE EmpItems
SET itOnPosted = 1,
itBalAmt = HistItems.itBalNew + HistItems.itPostCalc
FROM @HistItems HistItems where HistItems.eiKey = EmpItems.eiKey and HistItems.DelFlag = 0
select * from EmpItems
If it's not broken, fix it until it is.
My Blog