I have two tables with the same columns
tbl_source (ID, Title) tbl_dest (ID, Title)
I want to update tbl_dest titles from the tbl_source where the ids in dest and source match. However, I don’t want to update the dest title if the source title is null (or blank).
I’ve got this:
UPDATE tbl_dest SET tbl_dest.Title = (SELECT title FROM tbl_source WHERE tbl_dest.id = tbl_source.ID and tbl_source.title is not null)
But it keeps inserting the nulls.
How would I construct such a query?
I am using SQL server 2005.
Thanks.
Use an inner join…