Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grouping issue
Message
 
 
À
11/06/2003 21:47:21
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00799203
Message ID:
00799207
Vues:
22
Try
SELECT t1.* FROM mytable t1
  WHERE EXISTS ( SELECT * FROM mytable t2 
               WHERE t2.keyfield = t1.keyfield 
                     AND t1.field1 = MAX( t2.field1))
>Hi everyone:
>
>Would someone please point me to a thread(s) wheer I can see a discussion of the syntax issues of grouping and returning (say) the max() of a field in the group, together with the correct row that corresponds to the max?
>
>
>E.g.
>Select max(myTable.row1), max(myTable.row2), max(myTable.row3), ...
>From myTable
>Group by myTable.row1
>
>
>Running something like this gives values for the third row that are erratic.
>
>I have a feeling that a subquery is required.
>
>I have re-subscribed to PUTM but the sub has not yet taken effect and the search values are all hashed out.
>
>TIA
>
>Godfrey
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform