开发者

Pivot 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:

Pivot sql query

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜