【发布时间】:2020-11-12 17:11:36
【问题描述】:
当我在 where 子句中使用别名引用时,为什么会收到“无效的列名”错误 Msg 207 Level 16 State 1 Line 14? 创建表临时 ( col1 nvarchar(25), col2 nvarchar(25) )
insert into temp
values ('Babahoyo', 'Ecuador'),
('Stavanger', 'Norway'),
('Seattle', 'USA'),
('New York City', 'USA')
select
row_number() over (order by col2) as N,
col1, col2
from
temp
where
n = 2
【问题讨论】:
标签: sql sql-server tsql