I am using the following code to update my mysql table where both moving50 and moving200 are variable characters.
String sql = "update toplosers set Moving50 = ?, where Symbol = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
for(int i1=0;i1<i;i1++)
{
stmt.setString(1, moving50[i1]);
stmt.setString(2,symbol[i1]);
stmt.addBatch();
}
stmt.executeBatch();
}
I am getting “have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘where Symbol = ‘mysymbol” at line 1
What is the problem
No need to add ‘comma’ for where clause.
Now check it.
see sample example here