最新消息: 新版网站上线了!!!

mysql常用的笔记

UPDATE bt_fck INNER JOIN bt_fck AS b ON bt_fck.re_name=b.user_id
SET bt_fck.re_id=b.id  //通过推荐人的编号修改re_id

UPDATE bt_fck A 
INNER JOIN (SELECT *,COUNT(*) idcount FROM bt_fck GROUP BY re_id) AS B
  ON B.re_id = A.id
SET A.re_nums = B.idcount//mysql 统计推荐人数
UPDATE bt_fck AS A
LEFT JOIN bt_pp AS B
  ON B.code = A.user_id
SET A.u_level = B.ulevel  // 链表更新
.....

转载请注明:谷谷点程序 » mysql常用的笔记