Sql server 2008 r2 SQL Server在选择中选择无效的列名

Sql server 2008 r2 SQL Server在选择中选择无效的列名,sql-server-2008-r2,Sql Server 2008 R2,我正在使用SQL Server。我有以下疑问: select convert(varchar(10), MAX(closedate), 101) from (select PSer.Signin_Date as closedate from PSer where ID = '12') 请注意,我的from中的内容比我的简化版本更复杂 我收到一条消息说 列名closedate无效 确保为子查询指定了别名 from ( select PSer.Sign

我正在使用SQL Server。我有以下疑问:

select 
    convert(varchar(10), MAX(closedate), 101) 
from 
    (select PSer.Signin_Date as closedate 
     from PSer 
     where ID = '12')
请注意,我的from中的内容比我的简化版本更复杂

我收到一条消息说

列名closedate无效


确保为子查询指定了别名

from ( select PSer.Signin_Date as closedate from PSer where ID = '12') AS SOMENAME
使用以下命令:

select convert(varchar(10),MAX(t1.closedate),101) 
from ( select PSer.Signin_Date as closedate from PSer where ID = '12') as t1
享受