Jeg foreslår, at du bruger bestilling som i How Not To Sort By Average Rating
Demo:
CREATE TABLE clans(id INT, name VARCHAR(100), warswon INT, warslost INT);
INSERT INTO clans VALUES (1, 'aaa', 208, 6), (2, 'bbb', 103, 0);
SELECT id, name,warswon, warslost,((warswon + 1.9208) / (warswon + warslost) -
1.96 * SQRT((warswon * warslost) / (warswon + warslost) + 0.9604) /
(warswon + warslost)) / (1 + 3.8416 / (warswon + warslost))
AS ci_lower_bound
FROM clans
ORDER BY ci_lower_bound DESC;
Output:
╔═════╦═══════╦══════════╦═══════════╦════════════════════╗
║ id ║ name ║ warswon ║ warslost ║ ci_lower_bound ║
╠═════╬═══════╬══════════╬═══════════╬════════════════════╣
║ 2 ║ bbb ║ 103 ║ 0 ║ 0.9640439675800224 ║
║ 1 ║ aaa ║ 208 ║ 6 ║ 0.9401908847803808 ║
╚═════╩═══════╩══════════╩═══════════╩════════════════════╝