$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;
PLAYERS
id | name
1 test
PLAYER_STORAGE
player_id | key | value
1 1000 10
The query works fine the only is problem that the order is not correct, idk why.
