1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] SQL Server Pivot Columns to Rows

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 8, 2024 às 01:22.

  1. Stack

    Stack Membro Participativo

    I want to convert some columns to rows as shown in the below picture.

    SELECT TOP (1000) [Machine]
    ,(Date)
    ,[Shift]
    ,[ConeType]
    , count(ConeWeight) as Machines
    FROM [DB_SProd].[dbo].[TableProduction]
    Where ConeType='HIgh' OR ConeType='Low'
    group by Machine,Date,Shift,ConeType
    order by Machine, Date,Shift


    With the help of pivot I want result in Date, Shift, Machine, Low, High and so on as shown in the image

    Continue reading...

Compartilhe esta Página