1. SELECT
1.1 字符串转对应的名称
一串用户id字符串(逗号分割),需要转成对应的用户昵称
-- view_members 用户id集合(uid1,uid1,uid3)
-- view_member_names 用户昵称集合(uname1,uname1,uname3)
select
tb.*,
(select group_concat(tu.name) from t_user tu where find_in_set(tu.id,t.view_members)) as view_member_names
from t_bussiness tb
2. UPDATE
2.1 update和select结合使用方式 批量更新
1️⃣ inner join内连接方式
update A inner join B on A.bid=B.id set A.bname = B.name
update t_A a
inner join (select b.id,b.name from t_B b) tmpb on tmpb.id=a.bid
set a.bname=tmpb.name
2️⃣子查询方式
update u
set u.city_no = ( select c.city_no from t_city c where c.city_uid = u.city_uid)
from t_user u
3️⃣ 笛卡尔积方式
update u
set u.city_no = c.city_no
from t_user u, t_city c
where c.city_uid = u.city_uid
4️⃣update 多表更新
___mark一下,没用过___
update table1 t1,table2 t2,......,tablen tn
set t1.column=?, t2.column=?.......,tn.column=?
where t1.xx=?,t2.xx=?,......tn.xx=?