Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

308
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda