Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to GROUP BY ON 2 fields in SQL
Message
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01362746
Message ID:
01363013
Views:
33
This message has been marked as a message which has helped to the initial question of the thread.
Dmitry,

SQL Server will let you ORDER BY ordinal position in the result set, but it won't let you GROUP BY.
Select MyField1, myField2 from myTable group by MyField1, MyField2 order by 1,2
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform