Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query without max()
Message
From
15/09/2019 05:37:43
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/09/2019 01:19:01
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01670845
Message ID:
01670866
Views:
56
>>>
>>>Sir I wrote this query by myself
>>>
>>>SELECT  a.code, a.names, a.country,b.qty 
>>>FROM #table1  a, 
>>>   (
>>>   SELECT code, sum(qty)as qty
>>>FROM #table1
>>> GROUP BY code
>>> ) b
>>>WHERE a.code = b.code
>>>
>>>
>>>This display the correct sum of qty but with double row like this
>>>
>>>1104 ERIC Holland 110
>>>1104 ERIC Holland 110
>>>1105 Boris Bulgaria 90
>>>1105 Boris Bulgaria 90
>>>1106 Anil India 100
>>>1106 Anil India 100
>>>1107 Cetin Turkey 150
>>>1107 Cetin Turkey 150
>>>
>>>It will be great help if you modify this query.
>>>
>>>Please
>>
>>If you meant to get this output, then it is a correct way to write it. Another way is:
>>
>>
>>SELECT code, names, country,
>>       SUM(qty) OVER (PARTITION BY code) AS qty
>>FROM #Table1
>>ORDER BY code;
>>
>
>Sir your above query shows double result like shown in attachment.

I don't understand what you want. Wasn't that what you requested?
Ç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