Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incorrect Syntax Error
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01323625
Message ID:
01323686
Vues:
15
In the query #2 from wich record do you expect result value for Descript would come from for each group? SQL Engine does not have this info and cannot proceed.
Table: mytable
Code Descript Qty
  1  One      110
  1  OneOne   120
  2  Two      210
  2  Two      220

-- #1
SELECT Code, SUM(Qty) FROM mytable GROUP BY Code
Result
Code Qty
  1  230
  2  430

-- #2
SELECT Code, Descript, SUM(Qty) FROM mytable GROUP BY Code
Result
Code Descript  Qty
  1  ?         230
  2  ?         430
>
>"....than SQL engine wouldn't know what record it should come from"
>
>Huh?? I don't get this.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform