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

164
Vistas
Deleting multiple rows given an array of values in MySQL with Node.js and Express.js

I'm trying to delete multiple rows in a MySQL table that match up with multiple values in an array.

Here's an example of my attempt:

const query = 'DELETE FROM example_table WHERE (a_id AND b_id AND c_id) IN ?';
const values = [
      { a_id: 1, b_id: 2, c_id: 3},
      { a_id: 4, b_id: 5, c_id: 6},
      { a_id: 7, b_id: 8, c_id: 9}
     ];

connection.query(query, values, function(err, results) {
     // do something
});

So, I'm essentially trying to find the rows whose column values matchup with the values in the objects in my array. I think my problem is that my query statement is not necessarily comparing the values at all, or that my logic in tackling this problem is not correct.

What should the query statement be, or should I be doing this another way?

Thank you.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

const query = 'DELETE FROM example_table WHERE a_id in (?) and b_id in (?) AND c_id IN (?)';
const values = [
      { a_id: 1, b_id: 2, c_id: 3},
      { a_id: 4, b_id: 5, c_id: 6},
      { a_id: 7, b_id: 8, c_id: 9}
     ];

connection.query(query, values, function(err, results) {
     // do something
});
about 4 years ago · Santiago Trujillo Denunciar
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