1

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: alt text

Please help me writing the sql query.

2
  • 1
    You have to specify what RDBMS you are in since OLAP queries are very DB dependent these days... Commented Jan 13, 2010 at 11:59
  • I'm using SQL Sever 2005 Commented Jan 13, 2010 at 12:39

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.