Friday, 29 April 2016

Update On inner Join

    select  T.id,T1.IsFinalStatus_FirstLevel,T.IsFinalStatus_SecondLevel,T1.IsFinalStatus_SecondLevel As Change
    from IGRS_Report..tbl_Complaints_CompiledStatus T inner join IGRS_Report..tbl_Complaints_CompiledStatus T1

    On T.ComplaintCode=T1.ComplaintCode and  T1.IsFinalStatus_SecondLevel='ATRS' and T1.IsFinalStatus_FirstLevel <> 'ATRS'
    and T1.ComplaintCode=10159160008930
     and T.id >=T1.id

----------------------Update----------------------------------
     Update
    T set
    T.IsFinalStatus_FirstLevel=T1.IsFinalStatus_SecondLevel
    from IGRS_Report..tbl_Complaints_CompiledStatus T inner join IGRS_Report..tbl_Complaints_CompiledStatus T1

    On T.ComplaintCode=T1.ComplaintCode and  T1.IsFinalStatus_SecondLevel='ATRS' and T1.IsFinalStatus_FirstLevel <> 'ATRS'
    and T1.ComplaintCode=10159160008930
     and T.id >=T1.id

No comments:

Post a Comment

Table Partitioning in SQL Server

  Table Partitioning in SQL Server – Step by Step Partitioning in SQL Server task is divided into four steps: Create a File Group Add Files ...