SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Group by


Group by

Author
Message
Manie Verster
Manie Verster
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2327 Visits: 1030
Thanks to all for the positive comments and thanks Hugo for the logical explanation you gave. Helps a lot!

Tom please tell me what this means. "Na tog mi gun tuit mi ach ma thuiteas tog! Thig crìoch air an t-saoghal ach mairidh gaol is ceòl "

:-PManie Verster
Developer
Johannesburg
South Africa

I can do all things through Christ who strengthens me. - Holy Bible
I am a man of fixed and unbending principles, the first of which is to be flexible at all times. - Everett Mckinley Dirkson (Well, I am trying. - Manie Verster)
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)SSCoach (19K reputation)

Group: General Forum Members
Points: 19257 Visits: 12426
Manie Verster (9/10/2010)
Tom please tell me what this means. "Na tog mi gun tuit mi ach ma thuiteas tog! Thig crìoch air an t-saoghal ach mairidh gaol is ceòl "

Google translate recognises it as Scottish Celtic, but is not yet able to translate that to either English or Dutch.
Bing Translator thinks it's Hungarian and translates it to English as "Na train what gun tuit what ach thuiteas train today! Thig crìoch air an t-saoghal ach mairidh gaol also ceòl".
Guess which of the two competing sites I believe ;-)


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26579 Visits: 12506
Manie Verster (9/10/2010)
Tom please tell me what this means. "Na tog mi gun tuit mi ach ma thuiteas tog! Thig crìoch air an t-saoghal ach mairidh gaol is ceòl "

As Hugo said, it's Scotland's Celtic language, usually in English called Scottish Gaelic, or Gaelic for short (which of course creates confusion with Manx and Irish Gaelics) or in itself Gàidhlig na h-Alba. The first line means literally "Don't lift me unless I fall but if I fall do lift" but really "don't correct me unless I'm wrong but if I'm wrong do". The second line is a very old saying: "An end will come upon the world but love and music will survive".

Tom

Daniel Bowlin
Daniel Bowlin
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8316 Visits: 2629
I was up late last night working. I am looking at the question and thinking, "Gee, I didn't think you could group that way" and in my fatigue I chose the wrong answer instead of realizing that you can't group that way.
Paul White
Paul White
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36994 Visits: 11361
There is a "workaround":


SELECT DV.[Year],
SOH.SalesPersonID,
AverageOrderAmt = SUM(SOH.TotalDue)
FROM Sales.SalesOrderHeader SOH
CROSS
APPLY (SELECT DATEPART(yyyy,OrderDate)) DV ([Year])
GROUP BY
DV.[Year],
SOH.SalesPersonID
ORDER BY
DV.[Year] ;



Over to you, Hugo.

Paul



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
VinceV
VinceV
SSC Veteran
SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)

Group: General Forum Members
Points: 233 Visits: 136
Great question and even better follow up discussions. Thanks!
timothy bates
timothy bates
SSC Veteran
SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)SSC Veteran (252 reputation)

Group: General Forum Members
Points: 252 Visits: 124
Based on Hugo's LOGICAL progression where the group by preceeds the select. The alias is not yet defined so grouping is not possible against a column that does not yet exist. The Order By occurs post Select where the alias has been defined so it is acceptable. An alternative solution is Group by datepart(yyyy,orderdate).
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search