โ04-10-2023 10:51 PM
I have two tables EMPLOYEE & EMPLOYEE_ROLE. I'm trying to Update a column with a value from another column. I'm using SQL server join but i get an error -
[parse_syntax_error] Syntax error at or near 'FROM' line 3.
UPDATE C
SET C.title = B.title
FROM EMPLOYEE C
INNER JOIN EMPLOYEE_ROLE B
ON C.emp_id = B.emp_id
AND C.emp_name = B.emp_name
โ04-11-2023 12:09 AM
From the documentation, update statement is only supported for Delta Lake tables.
https://docs.databricks.com/sql/language-manual/delta-update.html. Can you check if your tables are delta
โ04-11-2023 03:04 AM
Yes they are delta tables
โ04-11-2023 06:54 AM
Hi @Vijesh Vโ
Thank you for posting your question in our community! We are happy to assist you.
To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?
This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance!
โ04-11-2023 11:09 AM
@Vijesh Vโ , you can use merge statement like below code snipplet:
merge into EMPLOYEE C
using EMPLOYEE_ROLE B
ON C.emp_id = B.emp_id AND C.emp_name = B.emp_name
when matched then
update set C.title = B.title
โ04-12-2023 09:50 AM
Hi @Vijesh Vโ
Try to use merge into to perform cdc between tables :
MERGE INTO target a
USING source b
ON {merge_condition}
WHEN MATCHED THEN {matched_action}
WHEN NOT MATCHED THEN {not_matched_action}
Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโt want to miss the chance to attend and share knowledge.
If there isnโt a group near you, start one and help create a community that brings people together.
Request a New Group