want to merge two tables on two columns, partid and serialid.
but then I want to check if the purchasedate also match, if it matches I leave it alone, otherwise I update the date and source. i having having issues with the if part.
MERGE [dbo].[tableone] T
USING [dbo].tabletwo S
ON (S.PARTID = T.PART_ID AND S.SERIAL = T.SERIAL)
--i would like to check here if the dates also match
-- do nothing
-- if they dont then update
THEN UPDATE SET
T.DATE = S.DATE...
---and then otherwise insert.