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

    Apr 10, 2013 · 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 the weeks are …

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

    A pivot is used to convert one of the columns in your data set from rows into columns (this is typically referred to as the spreading column). In the example you have given, this means converting the …

  3. sql server - T-SQL pivot where clause - Stack Overflow

    in SQL Server i want PIVOT a table and add a WHERE clause but i cant figure out the syntax. The data

  4. In SQL Server how to Pivot for multiple columns

    Mar 4, 2022 · The answer by Ankur Gupta gives the technique to use. You can have multiple pivots, but they cannot share the same "column that contains the values that become column headers" as …

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

    The columns besides for the pivot are the group by's. So you can create a row_number in your data partioned by the other group by's and include that in your pivot data. for example:

  6. SQL Server dynamic PIVOT query? - Stack Overflow

    This solution requires the creation of a stored procedure so if that is out of the question for your needs please stop reading now. This procedure is going to take in the key variables of a pivot statement to …

  7. sql - Pivoting rows into columns dynamically in Oracle - Stack Overflow

    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 dynamic sql as …

  8. 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 result from using a s...

  9. 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 have a ...

  10. sql server - How to pivot column values into columns? - Stack Overflow

    SELECT MachineName FROM Logins GROUP BY Username PIVOT BY CAST(LoginDate AS DATE) i just can't seem to wrap my head out the PIVOT syntax; in order to tell SQL Server what column …