Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting the first one from a group
Message
De
29/02/2000 01:13:30
 
 
À
29/02/2000 01:01:55
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00338912
Message ID:
00338955
Vues:
12
>>>select eval("min(sk, " + str(min(pk)) + ")"), sk from table group by sk
>>
>>Did you try it? Doesn't work for me.
>
>Yep.
>
>Just to be clear, this isn't a replacement for your second SELECT, this is an all in one SELECT.

Right. That's what I tested. My problem was that I was using character fields, not numeric. Even after removing the STR(... I still had a type mismatch.

This does the trick (and a nice trick at that, sir)
select eval("min(sk, " + [']+min(pk)+['] + ")"), sk from table group by sk
Surely there must be some way to make it even more cryptic?

Now let's see if Paul Vlad comes up with a pure SQL for the entire problem :-)
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform