在 SQL Server 2008 中,但未出现列名。我需要输入一个空字符串,因为这些行是在报告中手动填充的。
(SELECT '' As 'Total No of people')
它似乎显示为(No column name)
在 SQL Server 2008 中,但未出现列名。我需要输入一个空字符串,因为这些行是在报告中手动填充的。
(SELECT '' As 'Total No of people')
它似乎显示为(No column name)
你可以有
SELECT ID as 'ID',
(SELECT <....> FROM table WHERE <...> ) AS 'Total No of people'
FROM somewhere
您必须将列名放在)
内部选择之后
我会说它工作正常!http://sqlfiddle.com/#!3/d41d8/18149
但也许你的问题是你这样做(技术上使用子查询)
SELECT ID, (SELECT '' As 'Total No of people') FROM SomeWhere
那是错误的……
SELECT ID, '' As 'Total No of people' FROM SomeWhere
或者
SELECT ID, (SELECT '') As 'Total No of people' FROM SomeWhere
但没有内在的原因SELECT
确保您按顺序排列: SELECT '' As 'Total No of people' from PEOPLE