Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding records with unique order number?
Message
De
23/11/1999 13:50:45
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00294401
Message ID:
00294472
Vues:
24
>That's amazing!
>
>I had developed a routine which pulled all the records containing the item into one cursor, created an updatable version of it, then pulled all records that were not the item into another cursor and deleted matching order ids from the first cursor. It used only about 20 lines of code, and I was getting pretty proud of myself. Then you burst my bubble! (Not that I'm complaining!)
>
>I'll have to explore the count(*) instruction. I don't see any info on that variation in Help or the Hacker's Guide. Where can I find an explanation?
>
>Thanks very much!
>
>Neil
>
>>>Is there a quick method of selecting records where only a single instance of the order number exists?
>>>
>>
>>SELECT COUNT(*), OrderID FROM Mytable GROUP BY OrderID HAVING COUNT(*) = 1

COUNT() takes a field name or a wildcard, in this case, it doesn;t matter which you use. If you use COUNT(*) in a plain old query, the results contain a single record with the count. If you use a GROUP BY clause, COUNT() returns the number of records that got grouped.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform