so i was trying to run these lines of code
public void refresh() {
try {
String strUpdate = "SET SQL_SAFE_UPDATES = 0; \n"
+ "delete from cart where cart.ID in (select * from (select cart.ID from cart where cart.ID not in (select cart.ID from cart inner join orders where cart.OrderID = orders.OrderID))tblTmp);\n"
+ "SET SQL_SAFE_UPDATES = 1;";
System.out.println(strUpdate);
pstm = cnn.prepareStatement(strUpdate);
pstm.executeUpdate();
} catch (Exception e) {
System.out.println("RefreshCart:" + e.getMessage());
}
}
The 3 sql line ran fine in mySQL enter image description here but when i try to ran it in this function it returns an error enter image description here
i have the SQL statement printed out using System.out.println and it returned fine, even works when i recopy it back into mySQL workbench enter image description here