Introduction to PIVOT operator in SQL
Learn how to use the PIVOT operator in SQL in a step-by-step manner.
2020-02-06
13,113 reads
Learn how to use the PIVOT operator in SQL in a step-by-step manner.
2020-02-06
13,113 reads
Understand how to use the SQL UNPIVOT statement and then an equivalent using XML and XPath Querying in SQL Server.
2017-01-16
4,897 reads
Learn how to convert row values into column values (PIVOT) and column values into row values (UNPIVOT) in SQL Server.
2015-06-16
4,888 reads
Learn how to convert row values into column values (PIVOT) and column values into row values (UNPIVOT) in SQL Server.
2015-06-11
5,039 reads
Of all the basic SQL operations, the pivot seems to cause the most problems. It turns out that there are several questions that come to mind while learning about pivoting, but which are seldom asked on forums.
2015-01-19
11,491 reads
2014-08-18 (first published: 2014-07-28)
1,237 reads
2015-09-10 (first published: 2014-05-08)
4,843 reads
This script pivots 1 to N numeric columns, grouping by 1 to N (N)(Var)char columns, pivoting by distinct date.
2013-10-30 (first published: 2013-10-15)
1,081 reads
Pivoting is a common reporting requirement - data is stored in columns and you need to present it in rows. This was a nice feature that was added to SQL Server, but you don't always know all of the values you need to pivot on. This tip looks at how you can dynamically create the pivot command to handle these unknown values.
2012-11-09
5,308 reads
Script to convert to N Columns the rows in a table with PIVOT Operator
2009-06-05 (first published: 2009-05-15)
1,977 reads
By Steve Jones
I had mentioned some new T-SQL functions for SQL Server 2022 and a commenter...
This post comes off the back of my last, where I looked at issues...
By Vinay Thakur
As this is an Artificial Intelligence (AI) World, things are changing. We can see that...
hi, i spent some time today in an existing pkg replumbing 5 flat file...
Still trying to figure out options for automating the export the result of a...
A while into install I get a Microsoft OLE DB Driver for SQL Server....
What does this code return?
SELECT ( SELECT COUNT (*), MAX(soh.OrderDate) AS latestorder FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2011' AND soh.OrderDate < '01/01/2012') AS OrdersIn2000 , ( SELECT COUNT (*), MAX(soh.OrderDate) AS latestorder FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2012' AND soh.OrderDate < '01/01/2013') AS OrdersIn2001 , ( SELECT COUNT (*), MAX(soh.OrderDate) AS latestorder FROM Sales.SalesOrderHeader AS soh WHERE soh.OrderDate > '01/01/2013' AND soh.OrderDate < '01/01/2014') AS OrdersIn2002; GOSee possible answers