UPDATE    ScontrinoD
SET              SyncCS = 'CAN'
WHERE     (IDScontrinoDServer IN
                          (SELECT     ScontrinoD_1.IDScontrinoDServer
                            FROM          (SELECT     IDScontrinoTServer
                                                    FROM          ScontrinoT
                                                    WHERE      (Stato LIKE N'%AN%')) AS derivedtbl_1 INNER JOIN
                                                   ScontrinoD AS ScontrinoD_1 ON derivedtbl_1.IDScontrinoTServer = ScontrinoD_1.IDScontrinoTServer))