I need to update the table column with the join with other table My pseudocode for SQL is as follows:
update table1 T1 set T1.user = T2.product where T2.product like '%P12%'
and T1.order = T2.order;
I have also tried using JOIN query but it is giving error "SQL command not properly ended" using Oracle.
In oracle, Update using JOIN
is not allowed.
You can use MERGE
. It can update one table using another table (s).
MERGE INTO T1
USING (SELECT T2.PRODUCT,
T2.ORDER
FROM T2 WHERE T2.PRODUCT LIKE '%P12%') T2
ON ( T1.ORDER = T2.ORDER )
WHEN MATCHED THEN UPDATE
SET T1.USER = T2.PRODUCT