Search code examples
sqlsql-serverconsolidation

SQL Query for Consolidation


I need a little help...

I have two data tables:

Table of programmed circuits (theorical Itinerary) enter image description here Table of circuits covered by the sellers (Real Itinerary) enter image description here The result to be achieved:

enter image description here Thanks...


Solution

  • select isnull(a.date, b.date), isnull(a.seller, b.seller), a.[theoretical itinerary], b.[real itinerary] 
    from table1 a full join table2 b 
    on a.date=b.date and a.seller=b.seller