Dúvidas sobre CTE

  • Olá,

    Tenho uma tabela com vários registros e gostaria de colocar na mesma linha exemplo:

    data hora Entrada

    10/01/2011 08:00 1

    10/01/2011 12:00 2

    10/01/2011 14:00 3

    10/01/2011 18:00 4

    Utilizando o CTE tem como fazer alguma rotina para deixar na mesma linha tipo assim:

    data hora 1 hora 2 hora 3 hora4

    10/01/2011 08:00 12:00 14:00 18:00

    Muito obrigado

    André Gusdtavo

  • Ola Andre

    I don't speak Spanish/Portuguese but I think you are looking for PIVOT:

    http://msdn.microsoft.com/en-us/library/ms177410%28v=SQL.100%29.aspx

    Edit: Actually, maybe not 🙂

    ------------------------------------------------------------------------
    Bite-sized fiction (with added teeth) [/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply