Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ajuda com select
Message
From
17/07/2003 11:47:29
 
 
To
17/07/2003 10:50:57
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00811078
Message ID:
00811116
Views:
14
This message has been marked as the solution to the initial question of the thread.
>Tenho uma tabela , que entre outros campos , tem os seguintes : Codigo , NumCliente , NumDoc
>
>Preciso fazer um select que retorne , todos os registos , em que NumCliente e NumDoc , tenham valores iguais a um registo que já exista na Tabela .
>
>Exemplo
>
>Codigo          NumCliente             NumDoc
>1                    1                    1
>2                    2                    2
>3                    3                    3
>4                    4                    4
>5                    1                    1
>
>Quero que o select retorne a linha com o codigo 1 e 5 , porque estas linhas são iguias nos campos numcliente e numdoc


Busca os duplicados (tenha indices - tags - em NumCliente é NumDoc):
select NumCliente,NumDoc,Count(*) as knt ;
from tabela ;
group by NumCliente,NumDoc ;
having knt > 1 ;
into cursor duplicados
HTH


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Reply
Map
View

Click here to load this message in the networking platform