[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 590: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 646: sizeof(): Parameter must be an array or an object that implements Countable
Duplicidade Cadastro de Fornecedores - Fórum de Automação Comercial

Duplicidade Cadastro de Fornecedores

Tópicos relacionados ao Bematech Chef Office
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
Heron Willy
Mensagens: 31
Registrado em: 13 Mar 2015, 15:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Duplicidade Cadastro de Fornecedores

Mensagempor Heron Willy » 17 Mar 2015, 13:19

Execute o seguinte script para verificar registros duplicados:



(abra o SQL Lite e execute no SQL Editor)



SELECT

[NOME FORNECEDOR],CGC, COUNT (CGC) AS QTD_COD_DUPLICADOS

FROM FORNECEDORES

GROUP BY [NOME FORNECEDOR],CGC

HAVING COUNT (CGC) > 1

ORDER BY CGC



Execute o script abaixo para deletar os registros duplicados encontrados na tabela fornecedores:



DELETE T

FROM FORNECEDORES T

LEFT JOIN (SELECT [NOME FORNECEDOR],CGC, MIN([CÓDIGO FORNECEDOR]) AS MINREC

FROM FORNECEDORES

GROUP BY [NOME FORNECEDOR],CGC)T1

ON T1.[NOME FORNECEDOR]=T.[NOME FORNECEDOR] AND T1.CGC = T.CGC

AND T1.MINREC=T.[CÓDIGO FORNECEDOR]

WHERE T1.CGC IS NULL





Após, efetue um teste.

[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1107: count(): Parameter must be an array or an object that implements Countable

Voltar para “Retaguarda (Bematech Chef Office)”

Quem está online

Usuários neste fórum: Nenhum usuário registrado e 4 visitantes

cron