Home >Database >Mysql Tutorial >Mysql 4 sql statement special processing statement summary (collection)
The following editor will bring you a summary of the special processing statements of mysql's sql statements (must read). The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.
1. Update the entire table. If the value of a column in a row of data is empty, then let it and another The values of a column of fields are equal
UPDATE ot_tgbz set update_day=if(update_day is null,date,update_day);
2,Update the entire table, if a field is greater than 2, then update them all to 2;
UPDATE ot_user set xingyun_num=if(xingyun_num > 2,2,xingyun_num);
3, Replace all URLs containing http://www.jb51.net/ in the thumb field in the shop_goods table with empty ones.
update shop_goods set thumb= replace (thumb,'http://www.jb51.net/','') where thumb like '%http://www.jb51.net/%';
4、sql statement multi-field where query
$map= " CAST( `UE_account` AS CHAR CHARACTER SET utf8 ) LIKE '%$data%' OR CAST( `UE_accName` AS CHAR CHARACTER SET utf8 ) LIKE '%$data%' OR CAST( `UE_truename` AS CHAR CHARACTER SET utf8 ) LIKE '%$data%' OR CAST( `UE_phone` AS CHAR CHARACTER SET utf8
The above is the detailed content of Mysql 4 sql statement special processing statement summary (collection). For more information, please follow other related articles on the PHP Chinese website!