Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the latest cumlative gpa
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00632402
Message ID:
00632543
Vues:
12
One more way.
Select Gpauniq, Suniq, Cumgpa ;
	FROM gpahist g1 ;
	WHERE Str(Gpauniq) + Str(Suniq) IN ( ;
		SELECT Str(Max(Gpauniq)) + Str(Suniq) ;
			FROM gpahist ;
			GROUP BY Suniq)
>
* Using correlated query
>Select Gpauniq, Suniq, Cumgpa ;
>	FROM gpahist g1 ;
>	WHERE Str(Gpauniq) + Str(Suniq) IN ( ;
>		SELECT Str(Max(Gpauniq)) + Str(Suniq) ;
>			FROM gpahist g2 WHERE g2.Suniq = g1.Suniq)
>* If it's slow you can try to split it into two queries
>SELECT Max(Gpauniq) As Gpauniq, Suniq ;
>	FROM gpahist g2 ;
>	GROUP BY Suniq ;
>	INTO CURSOR crsMaxGpauniq
>Select g1.Gpauniq, g1.Suniq, g1.Cumgpa ;
>	FROM gpahist g1 ;
>   	  JOIN crsMaxGpauniq m1 ;
>		ON g1.Gpauniq = m1.Gpauniq ;
>			AND g1.Suniq = m1.Suniq
>
>
>>Hello Group,
>>
>>Every semester the students (suniq) cumulative gpa (cumgpa) is entered into
>>gpahist table. each cumulative gpa is given a gpauniq number. The largest
>>gpauniq integer for an associated suniq is the current GPA for that suniq.
>>
>>How do I change the following SQL to return one row for each suniq and the
>>latest cumgpa assoiated with it.
>>
>>SELECT gpauniq, suniq, cumgpa
>>FROM gpahist
>>
>>Thanks you
>>
>>Jim
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform