One of my colleagues asked how to create SQL query to show results as columns of a row, that actually stored in multiple rows in the table. Other co-worker suggested to use cursor to manually generate required rows.I’ve found a few links about SQL PIVOT. It is easy to start withhttp://www.kodyaz.com/articles/t-sql-pivot-tables-in-sql-server-tutorial-with-examples.aspx or http://programmingsolution.net/post/SQL-Server-Pivot-Converting-Rows-to-Columns-with-Dynamic-Query.aspx
More detailed are articles written by Itzik Ben-Ganhttp://www.sqlmag.com/article/tsql3/pivot-or-unpivot-your-data andhttp://www.sqlmag.com/content1/topic/pivot-or-unpivot-your-data/catpath/tsql3/page/2compaslightly How to use Pivoting Without Aggregation is described inhttp://www.sqlmag.com/article/tsql3/pivoting-without-aggregation
No comments posted yet.
© Michael Freidgeim
Theme by PiyoDesign. Valid XHTML & CSS.