Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query help(list recurring records in a DB)
Message
De
22/04/2010 12:16:07
 
 
À
22/04/2010 12:15:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01461504
Message ID:
01461515
Vues:
31
>>>Hello All
>>>so i messed up a table i had an records i enter even thou its the same can hav different client ids
>>>
>>>so i wrote this query
>>>
>>>SELECT COUNT(otest.fname) AS numrec,otest.fname,;
>>>    otest.prefix,otest.bday,otest.aoonumber,;
>>>   otest.id;
>>>     FROM MAINBASE!OTEST;
>>>GROUP BY otest.fname;
>>>HAVING (numrec) >(1);
>>>INTO TABLE dup
>>>
>>>
>>>so that works fine it opens a dup table an i see like
>>>
>>>Numrec   fname
>>>2                   peter
>>>3                      james
>>>
>>>but im trying to link the otest table an the dup table in such a way that instead of showing one row for Peter an moving to JAmes it will show me the two rows for peter and the three for james so i can do what i need to do with them. Im fully aware i can just go in the Db an manually do it but.dont really wanna do that way. Thanks
>>
>>select T.*, Dup.NumRec from OTest T 
>>inner join (select FName, count(*) as NumRec from oTest group by FName having count(*) > 1) Dup
>>on T.Fname = Dup.Fname
>
>
>
>what doesnt cnt stand for cause its not count is it?cause u use it a few times. an T im not sure what it is u say Otest T there T cant be short for table

oh a few changes..hold on
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform