Home Forums SQL Server 7,2000 T-SQL select [Employee_ID] = EmpID from dbo.Employee GROUP BY [Employee_ID] RE: select [Employee_ID] = EmpID from dbo.Employee GROUP BY [Employee_ID]

  • pcq0125 (2/20/2008)


    Hi,

    I am on SQL 2000 and I an having problem with the square parenthesis error on the GROUP BY,. Can sombody help? Thanks.

    select [Employee_ID] = EmpID from dbo.Employee group by [Employee_ID]

    Server: Msg 207, Level 16, State 3, Line 2

    Invalid column name 'Employee_ID'.

    Hello,

    It should be written as

    select EmpID As Employee_ID from dbo.Employee group by EmpID

    There is no need for the square parenthesis and it should be used only when there is a space in between the alias being used for a column.

    Hope this is clear.

    Thanks


    Lucky