一个SQL处理玩家等级

这篇博客记录了一个SQL语句的使用,该语句用于在mn游戏项目中批量处理所有玩家的等级和经验,将旧经验转换为新经验,涉及多个用户表的数据更新。
摘要由CSDN通过智能技术生成

之前在mn游戏项目中需要处理所有玩家等级和经验,旧经验刷成新经验, 用一个sql搞定了,记录一下。


select  @oxp:= "0,20,70,150,250,370,520,720,970,1220,1620,2120,2720,4120,5740,8000,10500,13300,18000,23200,29400,38400,48200,58700,72900,105300,144400,185700,234900,286600,348300,419500,494500,580200,677300,780300,896600,1026500,1161800,1311900,1565900,1841300,2139200,2462100,2809600,3185700,3588800,4022200,4485200,4978900,5507700,6069700,6666200,7316900,8005100,8736100,9507400,10320600,11198600,12121700,13095800,14141300,15237200,16384700,17610500,18896900,20240400,21669900,23161000,24743200,26396200,28145800,29965000,31886200,33881100,35990200,38210600,40512000,42931200,45471000,48106000";

select  @nxp:= "20,50,80,100,120,150,200,250,250,250,250,300,700,810,1243,1375,1540,2585,2860,3720,5400,5880,6300,8520,12960,15640,16520,19680,20680,30850,35600,37500,42850,48550,77250,87225,97425,101475,112575,190500,206550,223425,242175,260625,376100,403100,433400,463000,493700,528800,562000,596500,650700,688200,731000,771300,813200,878000,923100,974100,1045500,1095900,1147500,1225800,1286400,1343500,1429500,1491100,1582200,1653000,1749600,1819200,1921200,1994900,2109100,2220400,2301400,2419200,2539800,2635000";


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


update mng_user_0 a,
(select
@level:= level,
@xp1:= substring_index(substring_index(@oxp, ',', (@level)), ',', -1) as x1,
@xp2:= substring_index(substring_index(@oxp, ',', (@level+1)), ',', -1) as x2,
@_xp:= @xp2- @xp1,
@xp3:= substring_i

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值