Miscellaneous - Useful Hacks!
- supriyamalla
- Jul 13, 2020
- 1 min read
1. I had to update multiple rows in a table. I was lazy to write repetitive UPDATE query for each record, so googled efficient way to do it.
Here's how you can do it:
update friends set email = case id when 1 then 'jane@codecademy.com' when 2 then 'girl1@codeacademy.com' when 3 then 'girl1@codeacademy.com' end where id in (1, 2, 3);
Follow this link:
Additional ways:

Comments