Skip to content
Advertisement

Tag: sql-update

Query to update duplicates

I have the following query that returns duplicates that i am running on sql server. So I need to write a query that will update second instance of the email address based on the select query that retrieves dulicates to for example imports@rohnis.com to imports@rohnis.com.duplicate. If it is info@eps.ws then info@eps.ws.duplicate. So basically postfix the email address with the word

Update column with below query?

How do I write this query to update a column based on the case statement? Answer As commented, you query looks pretty good, apart from these: the ORDER BY clause does not make sense; an UPDATE query does not return any record, so ordering is out of scope for the same reason, you don’t have to alias the updated column

Advertisement