Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Adding fields in a cursor then removing duplicates
Message
De
23/06/2005 06:48:12
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01025744
Message ID:
01025747
Vues:
14
>I have a cursor which is populated using a select sql. Here is a typical view of the table:
>
>
>
>Fabric                   Supplier               Artikey                   Rating
>---------                ----------             ----------                --------
>Zoom                     Ozbucek                F*000001                  1.29
>TMI                      TMI                    F*002345                  0.21
>Yao Hung                 Exquisite              F*002134                  1.21
>Zoom                     Ozbucek                F*000001                  0.89
>
>
>
>What I would like to do is if there are duplicate records I want to just have one record and add the rating of any duplicates. For example my new cursor would see that there is more than 1 artikey with the same artikey so it would add the rating of the second occurence to the first record then delete any duplicates. My new cursor would like:
>
>
>
>Fabric                   Supplier               Artikey                   Rating
>---------                ----------             ----------                --------
>Zoom                     Ozbucek                F*000001                  2.18
>TMI                      TMI                    F*002345                  0.21
>Yao Hung                 Exquisite              F*002134                  1.21
>
>
>
>
>Is this possible to do?
>
>Many Thanks

As a first stab try:
SELECT Fabric, Supplier, Artikey, SUM(Rating);
  FROM table;
 GROUP BY Rating
Kev
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform