Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query without max()
Message
From
14/09/2019 03:23:49
 
 
To
14/09/2019 03:18:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01670845
Message ID:
01670851
Views:
53
>>
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform