Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Name Query Output Columns in MS SQL Server?

Each column in the query output has a default name. If you don't like the default name, you can specify a new name for any column in the query output by using the AS clause. The following statement shows you a good example:

SELECT tag AS Category, YEAR(created) AS Year,

COUNT(*) AS Counts FROM ggl_links

GROUP BY tag, YEAR(created) ORDER BY COUNT(*) DESC

GO

Category Year Counts

HTML 2003 1

SQL 2004 1

SEO 2005 1

Jobs 2006 1

XML 2006 1

XSL 2007 1

JavaScript 2007 1

 148 views

More Questions for you: