Skip to content
Advertisement

How to select “Group” column name from another table in an SQL Server?

Group is column in one of the table. I am using below query. As Group is reserve keyword, getting error while executing below query:

select o.group as group,
 p.id as id 
from
product p left join org o on p.id=o.id

Could anyone guide?

Advertisement

Answer

Regular SQL Server way:

select o.[group] as [group],

And SQL Server does also support the ANSI SQL way (perhaps some setting needed?)

select o."group" as "group", 
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement