table 表(条件type=0)的字段 field_name 中 “old” 更改为 "new"
update table set field_name=replace(field_name,'old','new') where type=0;
将(条件id>100的)type为1176 更新为type 为1172;
UPDATE table_name
SET type=1172 WHERE type=1176 and id>100;
联合表一 表二,筛选等级大于自己等级+18的用户
SELECT u.user_id
,u.cur_level
, COUNT(t.user_id
) AS us ,u.create_time
FROM table1
AS u LEFT JOIN table2
AS t on u.user_id
=t.user_id
GROUP BY u.user_id
HAVING us>(u.cur_level
+18);