Summary of special SQL statements for mysql (mandatory), mysqlsql
1,Update the entire table. If the value of a column in a row of data is null, make it equal to the value of another field.
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, update them to 2;
UPDATE ot_user set xingyun_num=if(xingyun_num > 2,2,xingyun_num);
3,Replace the network segments containing http://www.bkjia.com/in the thumb field in the shop_goods table with all parts empty.
update shop_goods set thumb= replace (thumb,'http://www.bkjia.com/','') where thumb like '%http://www.bkjia.com/%';
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 ) LIKE '%$data%'";
The preceding summary of special SQL statements for mysql (mandatory) is all the content that I have shared with you. I hope you can give me a reference and support me a lot.