Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Composing an update query
--- 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
You can’t perform that action at this time.