update mall_user set team_num = (select * from (select (count(1) + 1) a from mall_user where p_ids like #{likeId}) r), promotion_num = (select * from (select count(1) a from mall_user where p_ids like #{likeId} and is_vip = 1) r), DIRECT_PUSH_NUM = (select * from (select count(1) a from mall_user where p_id = #{id}) r), effective_direct_push_num = (select * from (select count(1) r from mall_user where p_id = #{id} and is_vip = 1) r), one_star_condition = (select * from (select count(1) a from mall_user where p_ids like #{likeId} and USER_LEVEL_ID = '1') r), two_star_condition = (select * from (select count(1) a from mall_user where p_ids like #{likeId} and USER_LEVEL_ID = '2') r), three_star_condition = (select * from (select count(1) a from mall_user where p_ids like #{likeId} and USER_LEVEL_ID = '3') r), four_star_condition = (select * from (select count(1) a from mall_user where p_ids like #{likeId} and USER_LEVEL_ID = '4') r) where id = #{id} 死锁了怎么办
时间: 2023-06-02 07:06:47 浏览: 151
在Spring中用select last_insert_id()时遇到问题
这是一条SQL语句,用于更新mall_user表中的team_num字段值。具体的更新规则是以当前用户的层级关系为基础,将其下属团队成员数目作为team_num的值。其中,子查询语句(select count(1) 1 from mall_user where p_ids like '当前用户id,%')用于获取当前用户下属成员的数量。需要注意的是,该SQL语句中存在语法错误,在子查询语句的最后缺少一个括号。正确的写法应该是:update mall_user set team_num = (select * from (select (count(1)) a from mall_user where p_ids like '当前用户id,%') b)。
阅读全文