Updating multiple table-based rows in SQL Server Compact Edition

How to update rows based on multiple tables in SQL Server Compact Edition?

I have two tables in the database. ActivatedProducts and DocumentSettings.I added a new column (UID) to the DocumentSettings table, I want to put this UID data from the ActivatedProducts (ID) table in relation to ProductID from the ActivatedProducts table.

The following query also does not work, please help me

UPDATE DocumentSettings
SET UID = 
    (
        SELECT ActivatedProducts.ID
        FROM ActivatedProducts
        WHERE DocumentSettings.TitleID = ActivatedProducts.ProductID
    )


UPDATE A
    SET A.UID = B.ID
FROM DocumentSettings A, ActivatedProducts B
WHERE A.TitleID = B.ProductID


UPDATE DocumentSettings 
    SET [UID]=AP.[ID] 
FROM  DocumentSettings DS  
INNER JOIN ActivatedProducts AP ON DS.[Titleid]=AP.[ProductID]  
+3
source share
2 answers

, , SQL Server CE UPDATE-FROM-JOIN. 3, , Sql, CE .

: (SQL Server Compact - 2008)

+3

,

    UPDATE [table one]
        SET [table one].result = [table two] .results
        FROM [table one] T1
        INNER JOIN [table three] t3
         on t1.reg_id = t3.reg_id
        INNER JOIN [table two] T2
         on t2.venue = t3.venue
-1

Source: https://habr.com/ru/post/1789941/


All Articles