Created
July 31, 2012 15:17
-
-
Save jennings/3217735 to your computer and use it in GitHub Desktop.
Composing an update query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- While composing an update query, it's useful to use | |
--- a SELECT statement first to make sure you're going to | |
--- update the correct rows. Formatting the query in | |
--- this manner lets you alternate between SELECT and UPDATE | |
--- without commenting and uncommenting parts of the query. | |
SELECT * | |
FROM | |
-- UPDATE TableToUpdate --- Use ALT + Drag to highlight this update | |
-- SET ColumnToUpdate = Value --- and the where clause when you're ready | |
-- FROM --- to perform the update | |
TableToUpdate tu | |
JOIN SomeJoinTable sj | |
ON tu.Id = sj.Id | |
WHERE | |
tu.Something = 34 | |
AND sj.SomethingElse = 'A' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment