i am trying to an insert statement using last_insert_id() , i want to take the last inserted ID and insert it as a foreign key in an another table.
this is the statement :
String stt= "insert into Takes_lesson values (lid,sid) (LAST_INSERT_ID(),"+sid+");";
yet a syntax error occurs , what seems to be the problem?
thanks in advance
Keyword/operands in the wrong order..
The column specification should be before the
VALUESkeyword when doing anINSERT, compare your query to the below: