试试这个
SELECT if (
height <
if (
Weight <
if (Score < if (ID < RANK, ID, RANK),
Score,
if (ID < RANK, ID, RANK)),
weight,
if (Score < if (ID < RANK, ID, RANK),
Score,
if (ID < RANK, ID, RANK))
),
height,
if (
Weight <
if (Score < if (ID < RANK, ID, RANK),
Score,
if (ID < RANK, ID, RANK)),
weight,
if (Score < if (ID < RANK, ID, RANK),
Score,
if (ID < RANK, ID, RANK))
)
),
if (
height >
if (
Weight >
if (Score > if (ID > RANK, ID, RANK),
Score,
if (ID > RANK, ID, RANK)),
weight,
if (Score > if (ID > RANK, ID, RANK),
Score,
if (ID > RANK, ID, RANK))
),
height,
if (
Weight >
if (Score > if (ID > RANK, ID, RANK),
Score,
if (ID > RANK, ID, RANK)),
weight,
if (Score > if (ID > RANK, ID, RANK),
Score,
if (ID > RANK, ID, RANK))
)
)
FROM properties;
它只会给你第一个(最小值)和最后一个(最大值)。同样,您可以实现中间值,这显然是一项笨拙的工作。无论如何,我不知道它是否可以轻松地用 PHP(或其他语言)实现。