0

i have to update one tables field based on the where condition.

select ttc.*,
(case 

when ttc.TagId1=t.Id  then TagDescription1 
when ttc.TagId2 =t.id then TagDescription2 
when ttc.TagId3 =t.id then TagDescription3
when ttc.TagId4=t.id then TagDescription4 
end )  TagDescription from @tagIDTable temp
inner join Table1 T on temp.ID =t.Id 
left join Table2 TTC on TTC.TagId1 =t.Id 
or TTC.TagId2 =t.Id 
or TTC.TagId3 =t.Id 

above is the select statement i wrote. I have to update the tagdescription field. we have 4 tagdescriptions. based on the the where condition i need to update it. how to do the update in an optimized way

vinton
  • 49
  • 6

0 Answers0