How do I perform a GROUP BY on an aliased column in MS-SQL Server?

后端 未结 12 1804
慢半拍i
慢半拍i 2020-11-29 00:20

I\'m trying to perform a group by action on an aliased column (example below) but can\'t determine the proper syntax.

SELECT       LastName + \', \'         


        
12条回答
  •  迷失自我
    2020-11-29 01:05

    In the old FoxPro (I haven't used it since version 2.5), you could write something like this:

    SELECT       LastName + ', ' + FirstName AS 'FullName', Birthday, Title
    FROM         customers
    GROUP BY     1,3,2
    

    I really liked that syntax. Why isn't it implemented anywhere else? It's a nice shortcut, but I assume it causes other problems?

提交回复
热议问题