-1

我正在使用 SQL Server。我有以下查询:

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

请注意,我的 from 中的内容比我拥有的简化版本更复杂。

我收到一条消息说

无效的列名已关闭

4

2 回答 2

0

确保你给你的子查询一个别名。

from ( select PSer.Signin_Date as closedate from PSer where ID = '12') AS SOMENAME
于 2012-08-10T15:31:35.833 回答
0

用这个:

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

请享用。

于 2012-08-10T15:37:10.797 回答