Jmsilva Posted January 13, 2020 Report Share Posted January 13, 2020 Olá! como ficaria um SELECT, para exibir SEMENTE as linhas em que os campos CODIGO e a DATACADASTRO sejam idênticas Pseudo código: Select * from <nometabela> where codigo=codigo and datacadastro=datacadastro; CODIGO,TIPO,DATA,QTDE result: 1,'S',01/01/2020, 10 1,'E',01/01/2020, 100 5,'E', 10/01/2020, 20 5,'S',10/01/2020, 5 5,'S',10/01/2020, 3 BLZ Quote Link to comment Share on other sites More sharing options...
alex2002 Posted January 13, 2020 Report Share Posted January 13, 2020 qual a dúvida? Quote Link to comment Share on other sites More sharing options...
Jorge Andrade Posted January 13, 2020 Report Share Posted January 13, 2020 Olá! como ficaria um SELECT, para exibir SEMENTE as linhas em que os campos CODIGO e a DATACADASTRO sejam idênticas Pseudo código: Select * from <nometabela> where codigo=codigo and datacadastro=datacadastro; CODIGO,TIPO,DATA,QTDE result: 1,'S',01/01/2020, 10 1,'E',01/01/2020, 100 5,'E', 10/01/2020, 20 5,'S',10/01/2020, 5 5,'S',10/01/2020, 3 BLZ Com im put e pesquisa somente um uma tabela? Ou comparando duas tabelas, como se fosse um RELATION? Quote Link to comment Share on other sites More sharing options...
Jmsilva Posted January 13, 2020 Author Report Share Posted January 13, 2020 Com im put e pesquisa somente um uma tabela? Ou comparando duas tabelas, como se fosse um RELATION? Uma única tabela.... acredito que é um select dentro de outro. Com group by. Quase conseguindo. Quote Link to comment Share on other sites More sharing options...
ADutheil Posted January 14, 2020 Report Share Posted January 14, 2020 Eu tentaria algo assim: SELECT * FROM nometabela INNER JOIN (SELECT * FROM nometabela GROUP BY codigo HAVING COUNT(id) > 1) dup ON nometabela .datacadastro = dup.datacadastro; Quote Link to comment Share on other sites More sharing options...
aferra Posted January 14, 2020 Report Share Posted January 14, 2020 Acho que seria isso SELECT codigo,datacadastro,Count(*) FROM <nome_tabela>GROUP BY codigo,datacadastroHAVING Count(*) > 1 Jmsilva 1 Quote Link to comment Share on other sites More sharing options...
Jmsilva Posted January 14, 2020 Author Report Share Posted January 14, 2020 Obrigados amigos! vou testar e retorno assim que possível ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.