$SQL->query('SELECT `p`.`name` AS `name`,
(SELECT `k`.`value` FROM `player_storage` k WHERE `k`.`key` = 1000 AND `k`.`player_id` = `p`.`id`) AS value
FROM `player_storage` k, `players` p WHERE `k`.`player_id` = `p`.`id` GROUP BY `name` ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 0 , 30;
id | name
1 test
player_id | key | value
1 1000 10
查询工作正常唯一的问题是订单不正确,idk为什么。
答案 0 :(得分:1)
您的示例将返回两列,您只需订购第二列。