I encountered an error with the server regarding a request to the database.
This is the error message:
java.sql.SQLSyntaxErrorException: There is an error in your SQL syntax; check the manual for your MySQL server version for ', Regione='e', provincia='q', comune= on line 1 Correct syntax to use around 'w''
This is the SQL query in question:
PreparedStatement ps = con.prepareStatement("SELECT * FROM azienda WHERE id_categoria=?, regione=?, provincia=?, comune=?"); ps.setInt(1, id); ps.setString(2, regione); ps.setString(3, provincia); ps.setString(4, comune);
Thanks in advance!
P粉1357999492023-09-07 14:55:18
If you use multiple conditions, try using AND:
SELECT * FROM azienda WHERE id_categoria=? AND regione=? AND provincia=? AND comune=?