Full Outer Join with all rows

  • Hi Everyone, I have the following Table A and Table B.

    I tried doing a full outer join in Tableau software but was not successful.

    Could i please check if my desired output below is possible?

    I did not include my code because i uses Tableau to do a auto full outer join with my common key as Store.

    I wish to do this in SQL 2008

  • louislsh

    use union

    select [Sales Date], Store, Product, Sold, cast(Null as Int) As SOH From TableA

    union all

    select Null As [Sales Date], Store, Product, Null As Sold, SOH From TableB

    I Have Nine Lives You Have One Only

  • Thank you very much! it's working now.

    I am able to show my report for those stocked but not show within a date range.

    Really very very grateful for your kind help.

  • for these types of queries you might want to have a look up the GROUP BY ROLLUP command - it is not used too often, but  it saves you using a union query

    from the Microsoft site here is an example



Viewing 4 posts - 1 through 3 (of 3 total)

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