Skip to content

Instantly share code, notes, and snippets.

@stevesohcot
stevesohcot / update.sql
Created October 18, 2020 01:35
SQL to Update based on a second table
UPDATE tblData
SET
tblData.field_one = tblSource.field_one
FROM
myTableNameHere tblData
INNER JOIN myOtherTableNameHere tblSource ON
tblData.id = tblSource.id
WHERE
tblData.field_with_criteria = 'x'
@stevesohcot
stevesohcot / first-of-month.sql
Created October 18, 2020 01:08
SQL First of the Month
SELECT DATEADD(month, DATEDIFF(month, 0, @mydate), 0) AS FirstOfMonth