Is it possible to execute the two update queries in phpmyadmin together?
Like wise
UPDATE jos_menu SET home = 0 WHERE 1;
UPDATE jos_menu SET home = 1 WHERE id = 9;
Now can we copy both these queries together and Run it on phpmyadmin sql query panel? will it be executed?
Yes, both queries will be executed. The only additional thing you might add is transaction. Thanks to that you'll be sure that both queries executed successful:
START TRANSACTION;
UPDATE jos_menu SET home = 0 WHERE 1;
UPDATE jos_menu SET home = 1 WHERE id = 9;
COMMIT;
update jos_menu set home=case id when 9 then 1 else 0 end
this will update all rows, setting 1 to all that have id=9, and 0 to the rest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With