Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
UPDATE table1 t1 SET t1.value_1 = CONCAT(t2.value_2,t1.value_1) WHERE t1.id = t2.t1_id AND t1.id = '0123';
任何人都可以帮助我如何执行上述查询吗? 基本上我需要取表 1 中的值并将表 2 中的值作为前缀。除了查询不知道 t2 是什么的明显问题外,一切似乎都很好。
像这样的东西
update ( select t1.value_1, t2.value_2 from table1 t1, table2 t2 where t2.id = t1.id and t1.id = '0123' ) set value_1 = value_1 || value_2
您需要确保 table2 具有唯一的 id 键约束,否则它将不起作用。