Can i give any condition in prepareStatement? I wrote like this way insert into leave(EMP_ID,LEAVE_TYPE,ELIGIBLE,AVAILED) values (?,?,?,?)where ELIGIBLE<15 AND AVAILED<15 .
update sm_leave_details set eligible = ? , availed = ? where emp_id = 111 and leave_type = ? AND where ELIGIBLE<15 AND AVAILED<15" These are not working.what will be the correct syntax for validating eligible and availed less than 15?
ya that is ok. I am inserting and updating in two different table. the data type of eligible and availed is int the error is showing:-java.sql.SQLException: Syntax error or access violation, message from server: " 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 'where ELIGIBLE<15 AND AVA ILED<15' at line 1"
Joined: Sep 06, 2003
You cannot have where ELIGIBLE<15 AND AVAILED<15 in the insert statement.
Just have insert into leave(EMP_ID,LEAVE_TYPE,ELIGIBLE,AVAILED) values (?,?,?,?) as the query.