Merge table with one single query?# Database - 数据库
c*n
1 楼
I am wondering if there is a qry can the following job:
Let's say if we have two tables, TBL_1, TBL_2 with the same structure:
field_x, field_y.
Values in field_x are supposed to be unique.
I want to merge TBL_2 into TBL_1, that is,
1) for whatever value x existing in both TBL_2.field_x and
TBL_1.field_x, update the filed_y of records in TBL_1 to
TBL_2.field_y.
2) for whatever value x existing in TBL_2 but not in TBL_1, append
these records to TBL_1.
Currently I implement this purpose using 3 qu
Let's say if we have two tables, TBL_1, TBL_2 with the same structure:
field_x, field_y.
Values in field_x are supposed to be unique.
I want to merge TBL_2 into TBL_1, that is,
1) for whatever value x existing in both TBL_2.field_x and
TBL_1.field_x, update the filed_y of records in TBL_1 to
TBL_2.field_y.
2) for whatever value x existing in TBL_2 but not in TBL_1, append
these records to TBL_1.
Currently I implement this purpose using 3 qu