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

SQL Create View By Combining Rows

Discussão em 'Outras Linguagens' iniciado por Stack, Junho 5, 2021.

  1. Stack

    Stack Membro Participativo

    I've got a table:

    +-------------------+-----------+----------+-----------+--------------+
    | FieldName | ValueChar | ValueNum | ValueBool | SubmissionID |
    +-------------------+-----------+----------+-----------+--------------+
    | Color | Red | NULL | NULL | 1 |
    | CrayonNumber | NULL | 38 | NULL | 1 |
    | IsToxic | NULL | NULL | TRUE | 1 |
    | CrayonCreatorName | Bob | NULL | NULL | 1 |
    | Color | Blue | NULL | NULL | 2 |
    | CrayonNumber | NULL | 17 | NULL | 2 |
    | IsToxic | NULL | NULL | FALSE | 2 |
    +-------------------+-----------+----------+-----------+--------------+


    I'd like to create a view that when queried would return:

    +-------+--------------+---------+-------------------+
    | Color | CrayonNumber | IsToxic | CrayonCreatorName |
    +-------+--------------+---------+-------------------+
    | Red | 38 | TRUE | Bob |
    | Blue | 17 | FALSE | NULL |
    +-------+--------------+---------+-------------------+


    Is this possible without stored procedures?

    Continue reading...

Compartilhe esta Página