I've SQL Server 2005 table COMPETITOR (Id, Title, cDate, Price) I want to format the query so that its view in Gridview will be like this:
Please help me writing the sql query.
I've SQL Server 2005 table COMPETITOR (Id, Title, cDate, Price) I want to format the query so that its view in Gridview will be like this:
Please help me writing the sql query.
SQL 2005 supports PIVOT
- the Books Online doc is http://msdn.microsoft.com/en-us/library/ms177410(SQL.90).aspx
The main shortcoming I've found with the PIVOT
stuff is that you must specify the column names, although you can use a query beforehand and inject the values into a varchar variable and then execute that.