Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

309
Visualizações
ER_PARSE_ERROR - Node MySql

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);
    commit;`
    , callback)
}

I am coming up with

ER_PARSE_ERROR

Update

I have two tables:

1) task (id, name, description, due_date, difficulty_id, course_id)

This table holds a list of tasks.

2) evaluated_tasks (student_id, task_id)

This table holds the tasks which are to be evaluated. When a task is evaluated for a specific student it has to be deleted from this table.

Now I want to create a new task. The thing is that after creating a new task then I have to insert to my evaluated_tasks table as many records as my students count. So each record will be a pair of two columns student_id and task_id.

The goal is to make all these on a single query. From my little research I saw I can use start_transaction and commit for mysql. The point is there might be a syntax error on this query.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda