Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select Max(field1) + its corresponding fields?
Message
 
 
À
22/10/2001 11:08:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00571652
Message ID:
00571657
Vues:
29
This message has been marked as the solution to the initial question of the thread.
>Field1, Field2
>10, 4
>15, 3
>7, 9
>Select Max(field1),field2 from table1
>does not work the way I need it to be. I need the max. value in Field1 (=15), and it's corresponding field2 (=3). The above select statement will give me the correct field1, but not returning its corresponding field2. I think it returns the first record in field2 instead.
>Is there a way to achieve what I need?
>Thank you all!!

In cases like this foxpro returns filed2 value from the last record in the physical order. Anyway
SELECT filed1, field2 ;
  FROM table1 ;
  WHERE filed1 in ( Select Max(field1) from table1)
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform