N/APosted on - 01/30/2013
Hi TechyV users and forumers!
May I ask you, how is SQL 2005 tabulate data works? Can I create my own tabular data? What is the benefit of this data?
Thank You and Have a Good Day!
How does SQL 2005 tabulate works?
Here is an example to show you how to use crosstab queries PIVOT in SQL Server 2005. In this example a table is created with 3 columns. Column SalesAss, ColumnFR1 and ColumnFR2.
// selects the three columns
SELECT SalesAssis, [FR1] AS FR2, [FR2] AS FR2
// create cross-tab results. The (ps) used to create a temporary table for the query result.
(SELECT SalesAssis, Product, Amount
FROM Sales ) ps
// pvt will collect the data from the query
FOR Product IN
( [FR1], [FR2])
) AS pvt
The brackets are necessary so that the pivot treats the name inside the brackets as columns.
I hope this is helpful.