Archive for the ‘SQL’ Category

The Sub-query vs. the “UPDATE FROM” Statement

From time to time I run across a table I need to update based on an ID column or other condition that doesn’t originate from that table. This usually occurs when there are one or more foreign keys in play. For instance, consider the tables below: