sql 平均分配用户

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/oYuLian/article/details/82803519

背景:将所有用户平均动态分配给几个人,

eg:将100个用户分配给3个人

UPDATE cl_remind_call a set a.operator_id =
CASE a.id % #{params.length}
<foreach collection="params.operateIdList" index="id" item="operateId">
    WHEN #{id} THEN #{operateId}
</foreach>
ELSE 0 END;

猜你喜欢

转载自blog.csdn.net/oYuLian/article/details/82803519
今日推荐