Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Update table with left join
Message
 
 
To
17/10/2011 11:48:14
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Desktop
Miscellaneous
Thread ID:
01526632
Message ID:
01526634
Views:
51
This message has been marked as a message which has helped to the initial question of the thread.
- SQL Server is picky about order of the clauses in a statement. They should be in the order as shown in BOL
- 'WHERE HistItems.DelFlag = 0' effectively turns your LEFT JOIN into INNER JOIN.

>is something like this possible? I get an error, but I thought it should have worked:
>
>UPDATE EmpItems 
>    LEFT JOIN HistItems ON HistItems.eiKey = EmpItems.eiKey
>    WHERE HistItems.DelFlag = 0 
>    SET EmpItems.itOnPosted = 1, EmpItems.itBalAmt = HistItems.itBalNew + HistItems.itPostCalc
>
>Maybe I'm doing something wrong?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform