-1

I have procedure where I am getting data from my 1st temp table like below

enter image description here

2nd temp table like below

enter image description here

Now I need to join this 2 temp tables to get all matching and unmatching data .My result would be like below

enter image description here

enter image description here

But I am getting only matching data.Please help how to do

GMB
  • 216,147
  • 25
  • 84
  • 135
Raja
  • 9
  • 2
  • This is a duplicate of question https://stackoverflow.com/questions/63197725/insert-update-data-help-in-sql-server/63198980#63198980 – Olga Romantsova Aug 01 '20 at 20:24

1 Answers1

0

I think that's a full join:

select 
    coalesce(t1.agentName, t2.agentName) agentName,
    coalesce(t1.completedTickets, 0) completedTickets,
    coalesce(t2.activeTickets, 0) activeTickets
from t1
full join t2 on t2.agentName = t1.agentName
GMB
  • 216,147
  • 25
  • 84
  • 135
  • Hi @GMB you approach is working.But I have 12 temp tables in my procedure.For coalesce I need to keep 12 times agent names and also need to do 12 joins.Would that be okay ?Please suggest – Raja Aug 01 '20 at 15:57