Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to factor my cursor?
Message
 
 
À
07/09/2006 11:53:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01151893
Message ID:
01151900
Vues:
30
This message has been marked as a message which has helped to the initial question of the thread.
I'm not sure how you want to compine xxxMult field. Try
SELECT Route, ClassType, Family, 
     SUM(PrevPassngers) AS PrevPassngers, MAX(PrevMult) AS PrevMult, ...
  ...
  GROUP BY 1,2,3
>I have a cursor with records as follows:
>
>Route  Class  SType  Family  PrevPassngers PrevMult PrevNumTrips CurrPassengers CurrMult  CurrNumTrips
>0588          D      G                386      1.75       676.79
>0588          D      G                                                     147      1.00        147.00
>0588          D      G                                                     194      1.00        194.00
>0588          D      G                                                     313      1.00        213.00
>0011          C      B                 33      1.75        57.86
>0011          C      B                                                       1      1.00          1.00
>0016          C      E                675      1.75      1183.51
>0016          C      E                                                       3      1.00          3.00
>0016          C      E                                                      17      1.00         17.00
>0016          C      E                                                      10      1.00         10.00
>...
>
>and need to condense/combine them into 1 rec for each Route/ClassStype/Family combo, i.e.
>
>Route  Class  SType  Family  PrevPassngers PrevMult PrevNumTrips CurrPassengers CurrMult  CurrNumTrips
>0588          D      G                386      1.75       676.79           554      1.00        554.00
>0011          C      B                 33      1.75        57.86             1      1.00          1.00
>0016          C      E                675      1.75      1183.51            30      1.00         30.00
>
>Is there a quick SQLish way of doing this without having to loop and append and accumulate and all that?
>There could just as easily be many recs to the left (prev) side to one or few on the right (curr)
>
>'ppreciate it
>
>Terry
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform