Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query without max()
Message
De
14/09/2019 03:23:49
 
 
À
14/09/2019 03:18:33
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01670845
Message ID:
01670851
Vues:
52
>>
>>Thanks sir Cetin Basoz for helping but I do not want to use more than one column in group by clause.
>>Is it possible to use ;with cte or some alternative method?
>>
>>Please
>
>If you look at it from possibility point, yes it is possible. ie:
>
>
>WITH totals (code, qty) AS 
>(SELECT code, SUM(qty)
>    FROM #Table1
>    GROUP BY code)
>SELECT t1.code, tn.Names, tn.Country, t1.qty
>FROM totals t1
>    CROSS APPLY (SELECT TOP (1) names, country
>    FROM #Table1 t2
>    WHERE t1.code = t2.code) tn(Names, Country)
>ORDER BY t1.code;
>
Thanks sir, it works
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform