I am new to node and mysql. I am developing an API.
Here's the case:
I want to make a web service and make two insertions on two different tables with a single query.
function createTask(taskInfo, callback) {
return db.query(`start transaction
insert into task values(null,'${taskInfo.name}','${taskInfo.description}',${taskInfo.dueDate},'${taskInfo.difficultyId}','${taskInfo.course_id}')
insert into evaluated_tasks (student_id, task_id)
(select id from user where type=1) , (select max(id) from task)
end transaction`
, callback)
}
I am coming up with
ER_PARSE_ERROR
via Korte
No comments:
Post a Comment