How to use JOIN in UPDATE query

I am very weak at join and i need to know that how can i convert following query using joins. This Query is working fine with sub queries but i need to convert it and use it making joins.

update dbo.TFIN_Stmt_Line_Item_Dtl 
set Stmt_Line_Item_Dtl_Desc='Changes from Baseline' 
where Stmt_Line_Item_Dtl_Desc='Increased Hours' 
and Stmt_Line_Item_Id 
in (select tmt_Line_Item_Ref_Id 
    from dbo.TFIN_Stmt_Line_Item 
    where Stmt_Line_Item_Type_Id =
        (select Stmt_Line_Item_Type_Id  
         from dbo.TFIN_Stmt_Line_Item_Type 
         where Stmt_Line_Item_Desc like 'ABOX/RBOX Amendment 18 and 20'))

Please if any body can help me.



Following query uses joins to update your table but if it would be faster remains to be seen.

Could you post the query plan so we can have a look at that

update  dbo.TFIN_Stmt_Line_Item_Dtl 
set     Stmt_Line_Item_Dtl_Desc = 'Changes from Baseline' 
from    dbo.TFIN_Stmt_Line_Item_Dtl dtl
        inner join dbo.TFIN_Stmt_Line_Item li on li.tmt_Line_Item_Ref_Id = dtl.Stmt_Line_Item_Id
        inner join dbo.TFIN_Stmt_Line_Item_Type lit on lit.Stmt_Line_Item_Type_Id = li.Stmt_Line_Item_Type_Id
where   dtl.Stmt_Line_Item_Dtl_Desc='Increased Hours' 
        and lit.Stmt_Line_Item_Desc like 'ABOX/RBOX Amendment 18 and 20'

Need Your Help

The awaitable and awaiter In C# 5.0 Asynchronous

c# asynchronous async-await c#-5.0

Task or Task<TResult> object is awaitable, so we can use await key on those whose return value is Task or Task<TResult>.

Android: List position from AutoCompleteTextview

android autocompletetextview

How can I get the position of an item from a List that I selected from an AutoCompleteTextview?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.