I'm using this query manually and it works fine, what I'm missing? If I don't use WHERE, it executes perfectly.
for (ArrayList<String> match : matches) {
System.out.println(match.get(0));
// String
// 7412095225787794836
String query1 = "SELECT COUNT(*) FROM `matches_players` WHERE `match_id` = ?";
PreparedStatement preparedStmt1 = (PreparedStatement) conn.prepareStatement(query1);
preparedStmt1.setString(1, match.get(0));
ResultSet rs1 = preparedStmt1.executeQuery(query1);
// You have an error in your SQL syntax; check the manual that corresponds to your
// MySQL server version for the right syntax to use near '?' at line 1
while (rs1.next()) {
System.out.println("players=" + rs1.getInt("COUNT(*)"));
}
}
match_idcolumn haveINTtype? Can you trypreparedStmt1.setInt(1, match.get(0).intValue());