Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query without max()
Message
From
14/09/2019 03:18:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/09/2019 02:55:52
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01670845
Message ID:
01670850
Views:
71
Likes (1)
>
>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;
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform