1
What would an Example of SQL Delete look like with Join or Union? I saw here in stackoverflow how to do in Mysql in sql Server more in Firebird I did not find or found in other forums. my SQL looked like this
DELETE FROM ANDAMENTOS_PROCESSUAIS
WHERE CODIGO_ANDAMENTO in(
SELECT
T2.CODIGO_ANDAMENTO
FROM ANDAMENTOS_PROCESSUAIS T2
LEFT JOIN PROCESSOS T3 ON T2.NUMERO_PROCESSO = T3.NUMERO_PROCESSO
WHERE
(T2.NUMERO_PROCESSO_AUX = T3.NUMERO_PROCESSO) AND (T3.FASE_PROCESSO LIKE 'ARQUIVADO')
UNION ALL
SELECT
T2.CODIGO_ANDAMENTO
FROM ANDAMENTOS_PROCESSUAIS T2
LEFT JOIN PROCESSOS T3 ON T2.NUMERO_PROCESSO = T3.NUMERO_PROCESSO
WHERE
(T2.NUMERO_PROCESSO_AUX = T3.NUMERO_PROCESSO2) AND (T3.FASE_PROCESSO2 LIKE 'ARQUIVADO'))
Is, is something missing in sql? Sort pass table in delete type ANDAMENTOS_PROCESSUAIS FROM ANDAMENTOS_PROCESSUAIS...
– ProsTecnologia