Skip to content
Advertisement

Update all rows with different values. When where conditions differ

Apologies in advance for the confusing title, but couldn’t quite find the right way to summarize it in the title.

I have a table in SQLite Studio with four columns ID, Name, Tm (which means team) and TmID (TeamID) and 326 rows

Obviously the query above allows me to update each row where the team is “NYY”, but I couldn’t find a way to update all 15 teams in one big query (other than possibly transactions which are a bit cumbersome in SQLite Studio). I’d like to assign each team its own unique sequential ID number.

Thanks in advance.

Advertisement

Answer

that would be like this by using case statement:

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