An Azure relational database service.
Hi @Raj0125
Try this query:
;WITH CTE AS
(
SELECT *,MAX(CASE WHEN Current_Ind='N' THEN Effective_Start_Date ELSE NULL END)OVER(PARTITION BY S_Id)AS New_Value
FROM TableName
)
UPDATE CTE SET Effective_Start_Date=New_Value, Inserted_Date=New_Value, Updated_Date=New_Value
WHERE Current_Ind='Y'
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.