I have 2 databases Alpha and Beta. Each database has identical table "Comments". The Comments table has 2 fields: ID and Comments. Alpha.Comments has only ID field populated, corresponding Comment field is empty. Beta.Comments has both ID and the corresponding comments. Is there SQL Query that can update all of Alpha.Comments field with appropriate entries from Beta, where ID matches?
3条答案
按热度按时间ni65a41a1#
已经有类似此请求的帖子-请查看:
Copy data from one column to other column (which is in a different table)
MySQL: Copy table to another table with an extra column
Join results from tables with same name from different databases
我相信还有其他的,所以你可以找到一个与你正在使用的数据库有关。
lp0sw83n2#
Something like:
In SQL Server, you can can express this as:
This handles duplicates in an unfortunate way. It arbitrarily chooses one for the assignment, so no error is generated.
nbysray53#
可以这样更新