sqlsql-serversql-server-2008

No column name showing up in SQL


In SQL Server 2008 but column name does not appear. I need to put in an empty string as the rows are populated manually in the report.

(SELECT '' As 'Total No of people')

It seems to show up as (No column name)


Solution

  • You can have

    SELECT ID as 'ID',
    (SELECT <....> FROM table WHERE <...> ) AS 'Total No of people'
    FROM somewhere
    

    You have to put the column name after the ) for the inner select