Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Design question before I start coding
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00692573
Message ID:
00692580
Vues:
24
>Here's my quandry, maybe you can point me in the right direction.
>
>I have a record in a table with up to 6 personnel names and test scores associated with each name meaning 6 people took the test at the same time and the results were recorded in one record.
>
>The table has multiple records like this and the 6 personnel names may or may not be the same from record to record and may appear in any one of the 6 positions.
>
>For example -
>Record 1
>Joe Smith 95 75 90 Mary Jones 80 85 90 John Doe 95 95 100 up to 6 names.
>Record 2
>Todd Williams 75 85 95 Jimmy Wilson 65 80 90 Joe Smith 100 95 100 up to 6 names.
>
>I have a second table with names of all students in it. How should I approach writing a program that compiles a summary of test scores for all students?
>
>I have started and stopped a couple of approaches, but am debating which way to go. Thanks for some guidance and direction.

Steve,

I think the best would be to first go to one record per student/score and take it from there
select student1      as student, ;
       score1        as score ;
    from table aa ;
    where ( student1 <> '' ) ;
   into cursor tmp ;
union all ;
select student2, ;
       score2 ;
    from table aa ;
    where ( student2 <> '' ) ;
union all ;
select student3, ;
       score3 ;
    from table aa ;
    where ( student3 <> '' ) ;
union all ;
select student4, ;
       score4 ;
    from table aa ;
    where ( student4 <> '' ) ;
union all ;
select student5, ;
       score5 ;
    from table aa ;
    where ( student5 <> '' ) ;
union all ;
select student6, ;
       score6 ;
    from table aa ;
    where ( student6 <> '' )

&& now you can proceed from here
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform