This commit is contained in:
15
help/异常经验数据修复.sql
Normal file
15
help/异常经验数据修复.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
SELECT
|
||||
player_id,
|
||||
-- 使用 CASE WHEN 实现条件判断:超过 1000 万重置为 200 万,否则保留原数值
|
||||
CASE
|
||||
WHEN (data->>'exp_pool')::bigint > 10000000 -- 判断是否超过 1000 万
|
||||
THEN 2000000::bigint -- 超过则重置为 200 万,统一为 bigint 类型避免类型不一致
|
||||
ELSE (data->>'exp_pool')::bigint -- 未超过则保留原 bigint 数值
|
||||
END AS online_time
|
||||
FROM "player_info"
|
||||
-- 保留 jsonb_exists 函数判断字段存在,避免占位符冲突
|
||||
WHERE
|
||||
jsonb_exists(data, 'exp_pool')
|
||||
AND (data->>'exp_pool')::bigint > 0 -- 此处仍保留原判断,过滤大于 0 的数据
|
||||
-- 按修正后的 online_time 降序排序
|
||||
ORDER BY online_time DESC;
|
||||
Reference in New Issue
Block a user