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

437
Visualizações
SQL - change the number of where clause values depending on number of values passed in

I have joined 2 tables and trying to delete the rows based on the order.id

DELETE order_attachment
FROM order
LEFT OUTER JOIN order_attachment
ON order.id=order_attachment.id
WHERE order.id = ?

Now the problem is number of order.id can be 1, 2, or 3 and they come in as an array. (Ex. [12311] or [12323, 45612] or [23413, 55675, 32512])

I want to delete all the rows in order_attachment table with the order.id with a single transaction.

Questions

  1. How can I delete all the rows with a single transaction?
  2. How can I change the number of ? based on orderId array length? (1 question mark if length is 1, 2 if length is 2, and 3 if length is 3)

Thank you!

about 4 years ago · Juan Pablo Isaza
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