diff --git a/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 81776bb75..6182376d6 100644 --- a/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/mcmmo-core/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -405,7 +405,7 @@ public final class SQLDatabaseManager implements DatabaseManager { for (PrimarySkillType primarySkillType : pluginRef.getSkillTools().NON_CHILD_SKILLS) { String skillName = primarySkillType.name().toLowerCase(Locale.ENGLISH); // Get count of all users with higher skill level than player - String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + + String sql = "SELECT COUNT(*) AS 'rank' FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id WHERE " + skillName + " > 0 " + "AND " + skillName + " > (SELECT " + skillName + " FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " + "WHERE user = ?)"; @@ -439,7 +439,7 @@ public final class SQLDatabaseManager implements DatabaseManager { statement.close(); } - String sql = "SELECT COUNT(*) AS rank FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " + + String sql = "SELECT COUNT(*) AS 'rank' FROM " + tablePrefix + "users JOIN " + tablePrefix + "skills ON user_id = id " + "WHERE " + ALL_QUERY_VERSION + " > 0 " + "AND " + ALL_QUERY_VERSION + " > " + "(SELECT " + ALL_QUERY_VERSION + " " +