Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GROUP BY to extract the most oldest record
Message
 
 
À
04/01/2003 15:39:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00738069
Message ID:
00738074
Vues:
30
>>I have a SQL which contains a GROUP BY clause. For the record that will be extract for each group, I need to extract the oldest one. I have a primary field that could be used for that. Basically, the lowest value in the primary field determines the first record that was created in that group. I'm trying to find the best approach in the SQL to achieve that.
>
>Ok, don't worry. I forgot to add MIN(Numero) AS Numero in my SQL which takes care of that. I forgot that it was so simple.

It'll give you MIN(Numero) for each group but the rest of the fields in the record, that are not in group by clause, will come from the last physical record in the group which may or may not be the record with MIN(Numero).
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform