About 41,500 results
Open links in new tab
  1. Convert Rows to columns using 'Pivot' in SQL Server

    Apr 10, 2013 · 412 If you are using SQL Server 2005+, then you can use the PIVOT function to transform the data from rows into columns. It sounds like you will need to use dynamic sql if …

  2. Understanding PIVOT function in T-SQL - Stack Overflow

    The pivot function works great when the source has 3 columns: One for the aggregate, one to spread as columns with for, and one as a pivot for row distribution.

  3. sql - TSQL Pivot without aggregate function - Stack Overflow

    sql parameterised cte query The answer to that question involves a situation where pivot without aggregation is needed so an example of doing it is part of the solution.

  4. t sql - Pivoting with Sum function in tsql - Stack Overflow

    Jul 6, 2012 · However, the plus with the dynamic pivot is that when you have data from additional years, you will not have to update the query to include those fields. The first part of the query …

  5. Sql PIVOT and string concatenation aggregate - Stack Overflow

    Feb 9, 2013 · I would like to use a pivot SQL query to construct a result table where the concatenate text as a result within the DATA section of the pivot table. i.e. i have the following …

  6. In SQL Server how to Pivot for multiple columns

    Mar 4, 2022 · This is my sample table, I want to pivot the category column and get the sales, stock and target as rows I want the sample output in this form as shown in the below wherein …

  7. SQL Server: Examples of PIVOTing String data - Stack Overflow

    Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I …

  8. sql - Pivoting rows into columns dynamically in Oracle - Stack …

    Apr 22, 2017 · First of all, dynamically pivot using pivot xml again needs to be parsed. We have another way of doing this by storing the column names in a variable and passing them in the …

  9. SQL Function that returns dynamically pivotted data

    Is it at all possible to have a table valued function in MSSQL that takes an attribute and generates an associated SQL statement with Pivot function? CREATE FUNCTION dbo.fnPivot …

  10. sql - How to pivot rows into columns in AWS Athena? - Stack …

    I'm new to AWS Athena and trying to pivot some rows into columns, similar to the top answer in this StackOverflow post. However, when I tried: SELECT column1, column2, column3 FROM …