1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

How to transform one SQL column into multiple columns on the same row?

Discussão em 'StackOverflow' iniciado por fdantas, Novembro 7, 2019.

  1. fdantas

    fdantas Administrator Moderador

    I am working in a Progress ODBC in Excel and I have a data set that currently holds an ID, Object type and the result for that object. The dataset looks a little like below:

    EveNumber ObjName TroValue
    1234 818 Artwork typeset duration 00:30:00
    1234 818 Artwork Estimated typeset duration 00:40:00


    I am trying to get this data to all sit on one line by using the following CASE WHEN

    Select

    Event_0.EveNumber
    ,(CASE WHEN Object_0.ObjName = '818 Artwork typeset duration' THEN TemplateRunObject_0.TroValue ELSE NULL END) AS 'BookedTime'
    ,(CASE WHEN Object_0.ObjName = '818 Artwork Estimated typeset duration' THEN TemplateRunObject_0.TroValue ELSE NULL END) AS 'EstimatedTime'


    What i am finding is that this results in a stepped result. So my returned data still comes back on multiple lines. Much like this:

    EveNumber BookedTime EstimatedTime
    1234 00:30:00
    1234 00:40:00


    Is there something i can do to return this result on the one line?

    Continue reading...

Compartilhe esta Página