About 198,000 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. In SQL Server how to Pivot for multiple columns - Stack Overflow

    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 …

  3. SQL Server dynamic PIVOT query? - Stack Overflow

    SQL Server dynamic PIVOT query? Asked 13 years, 7 months ago Modified 2 years, 2 months ago Viewed 372k times

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

    However, if you have more columns in the source it will break the results into multiple rows instead of one row per pivot based on unique values per additional column (as Group By …

  5. Simple way to transpose columns and rows in SQL?

    ) piv' exec(@query) See SQL Fiddle with Demo The dynamic version queries both yourtable and then the sys.columns table to generate the list of items to UNPIVOT and PIVOT. This is then …

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

    Apr 22, 2017 · I also added the in clause which is not optional for pivot. Of course, having to specify the values in the in clause defeats the goal of having a completely dynamic …

  7. sql - Efficiently convert rows to columns - Stack Overflow

    There are several ways that you can transform data from multiple rows into columns. Using PIVOT In SQL Server you can use the PIVOT function to transform the data from rows to …

  8. How to Pivot table in BigQuery - Stack Overflow

    So in your standard sql example, it assumes the values to be transposed to columns are known and unchanging. Is there a way to dynamically pivot columns?

  9. SQL PIVOT SELECT FROM LIST (IN SELECT) - Stack Overflow

    Is it possible to do a PIVOT and select list from a table, instead of using single values? Like this (incorrect syntax error): SELECT * FROM ( SELECT RepID, MilestoneID, ResultID FROM RM …

  10. SQL Server Pivot Table with multiple column aggregates

    The least complicated, most straight-forward way of doing this is by simply wrapping your main query with the pivot in a common table expression, then grouping/aggregating.