combine 2 queries in Union

  • Hello, I wish to combine 2 rows of result set of UNION. Example

    Select A,B,C,D

    from tabl1

    Union

    Select A,B,C,E

    from tbl2

    I wish the output to be

    A, B, C, D,E

  • Select A, B, C, D, E = CAST(NULL AS CorrectDataType)

    from tabl1

    Union

    Select A, B, C, D = CAST(NULL AS CorrectDataType), E

    from tbl2


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

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

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