Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query without max()
Message
De
15/09/2019 05:37:43
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
15/09/2019 01:19:01
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:
01670866
Vues:
55
>>>
>>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform