Skip to content
Advertisement

How to update multiple rows at the same time with one query

In cleaning a set of data, I came across several entries where there are multiples of a street name such as:

and

In total I have 25 street names that are misrecorded as the street name followed by (). I want to update all of the street names so that they are rewritten to drop the () and all read under the original street name. I can update like this:

and it works successfully, but I’d have to run 25 individual queries to do so. I’ll also have to do the same for the end station name. Is there a way I can combine this into one query to update them all at once?

Advertisement

Answer

You can do:

Note: This assumes that ' (*)' does not appear anywhere else in the names. That seems like a reasonable assumption.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement