Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incorrect Syntax Error
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01323625
Message ID:
01323686
Views:
14
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform