Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql counting duplicates, possible
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Sql counting duplicates, possible
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01620702
Message ID:
01620702
Vues:
129
Hi, Is is possible to use an sql statement(s) to count and number duplicates? The original table looks something like this, showing an excerpt where there are three entries for one date:
Mdate            Vs
05/28/2013     v1
05/28/2013     v1
05/28/2013     v1
The following is a start in that it will give me a table that shows how many duplicates exist for each date.
SELECT mdate,COUNT(mdate) FROM ch5 ;
    INTO TABLE dups;
    GROUP BY mdate ;
    HAVING COUNT(mdate) > 1
Here is a part of the report that the above produces:
mdate         cnt_mdate
05/28/2013   3
08/28/2013   2
And by using set relationship and a do while loop, I can count and label the duplicates. But I was just wondering if an SQL statement(s) could do it all? The final output that I need is::
Mdate            cnt/date    Vs
05/28/2013     1              v1
05/28/2013     2
05/28/2013     3
Thanks,
Steve
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform