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

161
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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