MySQL tiene la opción de unir campos con CONCAT
Por ejemplo:
SELECT fkcentro+fkidfactur+t70clinart FROM
Se deberia escribir:
SELECT CONCAT(fkcentro, fkidfactur, t70clinart)
Esto funciona bien… pero con tablas grandes es lentisimo… Es mejor excluirlos de una select.
Así por ejemplo esta SELECT
DELETE FROM ttab70 ;
WHERE fkcentro = «001» ;
AND (nhistorico = 0 OR nhistorico IS NULL) ;
AND fkcentro+fkidfactur+t70clinart NOT IN ;
(SELECT fkcentro+fkidfactur+t70clinart FROM _tmpdel_001_ttab70_ultima_sincro)
Se deberia escribir como:
DELETE FROM `ttab70`
WHERE fkcentro = «001» AND (nhistorico = 0 OR nhistorico IS NULL)
AND (fkcentro,fkidfactur,t70clinart) NOT IN
(SELECT fkcentro,fkidfactur,t70clinart FROM `_tmpdel_001_ttab70_ultima_sincro`)