Open rad-pat opened 5 months ago
@xudong963 and @zhyass - Mentioning you here since you worked on the original item referenced above.
merge into
is suitable for your case:
merge into target using source on target.c0 = source.c0 when matched then update set c1 = source.c1;
It would be, but currently not supported by SQLAlchemy and unlikely to be for some time (they already pushed it back like 10 years) so this is proving difficult. Update from subquery is fairly core SQL
Got you, update from subquery is on my list
I supported cte in update: https://github.com/datafuselabs/databend/pull/15276, though it won't solve your issue.
It only changed the error info for SQL: with s as (select c0, c1 from source) update target set c1 = s.c1 where target.c0 = s.c0
and the newest error info is expected.
such as
with tt1 as (select * from t1) update t2 set a = tt1.a;
----
mysql client error: Server error: `ERROR HY000 (1105): SemanticError. Code: 1065, Text = error:
--> SQL:1:54
|
1 | with tt1 as (select * from t1) update t2 set a = tt1.a;
| ^ column a doesn't exist
.'
OK, I see the change, many thanks. It's a step along the way. 🥳
Search before asking
Version
https://github.com/datafuselabs/databend/releases/tag/v1.2.423-nightly
What's Wrong?
Further to https://github.com/datafuselabs/databend/issues/9455
update
statement does not support update from query. I tried 2 different ways to update using query, but both are not working. Please see details on how to reproduceHow to Reproduce?
Are you willing to submit PR?