Files
bl/help/查询超规精灵.sql

8 lines
368 B
Go
Raw Normal View History

-- 所有宠物ID + 对应记录总数去重前
SELECT
(data->>'ID')::INT AS pet_id, -- 宠物ID
COUNT(*) AS total_records -- 该宠物的总持有记录数
FROM "player_pet"
WHERE data->>'ID' IS NOT NULL -- 过滤无宠物ID的无效记录
GROUP BY (data->>'ID')::INT
ORDER BY total_records DESC, pet_id ASC; -- 按数量降序ID升序排列