A simple question I’ve been asked:
Is it possible to merge two UPDATE queries, each on different WHERE conditions, into a single query?
For example, is it possible to merge the following two UPDATE statements into one?
mysql> UPDATE film SET rental_duration=rental_duration+1 WHERE rating = 'G'; Query OK, 178 rows affected (0.01 sec) mysql> UPDATE film SET rental_rate=rental_rate-0.5 WHERE length < 90; Query OK, 320 rows affected (0.01 sec)
To verify our tests, we take a …[Read more...]