Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding fields in a cursor then removing duplicates
Message
From
23/06/2005 06:48:12
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01025744
Message ID:
01025747
Views:
13
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform