Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query without max()
Message
From
15/09/2019 01:19:01
 
 
To
14/09/2019 09:47:26
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:
01670861
Views:
64
>>
>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform