Wiki source for MySqlUpdate
===MySQL Update===
==MySQL update==
%%(sql)
update language set language_code = lower(language_code)
%%
==MySQL update from data==
%%(sql)
update translation_country tc1
left join translation_country tc2 on tc1.country_id = tc2.country_id
set tc1.tcountry_order = tc2.tcountry_order
where tc1.language_id = 10 and tc2.language_id = 1
%%
==MySql Update doesnt always update==
MySql doesnt update if there is no change to the data this can be a problem if you are expecting a timestamp column to change
%%
mysql> select * from customer where id = 45;
mysql> update customer set name=char(67) where id = 45;
mysql> select * from customer where id = 45;
mysql> update customer set name=char(67) where id = 45;
%%
for second and future times you'll see row matched BUT no actual update !
%%
Query OK, 0 rows affected (0.11 sec)
Rows matched: 1 Changed: 0 Warnings: 0
%%
----
REFERRERS
{{backlinks}}
==MySQL update==
%%(sql)
update language set language_code = lower(language_code)
%%
==MySQL update from data==
%%(sql)
update translation_country tc1
left join translation_country tc2 on tc1.country_id = tc2.country_id
set tc1.tcountry_order = tc2.tcountry_order
where tc1.language_id = 10 and tc2.language_id = 1
%%
==MySql Update doesnt always update==
MySql doesnt update if there is no change to the data this can be a problem if you are expecting a timestamp column to change
%%
mysql> select * from customer where id = 45;
mysql> update customer set name=char(67) where id = 45;
mysql> select * from customer where id = 45;
mysql> update customer set name=char(67) where id = 45;
%%
for second and future times you'll see row matched BUT no actual update !
%%
Query OK, 0 rows affected (0.11 sec)
Rows matched: 1 Changed: 0 Warnings: 0
%%
----
REFERRERS
{{backlinks}}