实现功能:把数据库Db1中ammeter表的数据同步到Db2中的meter_bill表中去
代码如下:
INSERT INTO db2.meter_bill ( oms_meter_id, house_id, meter_no, meter_number, first_quantity, zoom, last_month, last_month_quantity, last_month_create_date, current_month, current_month_quantity, current_use_quantity, remark, create_by, creation_date, last_updated_by, last_updated_date, delete_flag ) SELECT _id, house_id, water_meter_no, ext_meter_no, first_quantity, zoom, last_month, last_month_quantity, last_month_create_date, current_month, current_month_quantity, current_use_quantity, remark, create_by, creation_date, last_updated_by, last_updated_date, delete_flag FROM db1.ammeter
实际上就是把从db1的ammeter表中查出来的数据,插入到db2中的meter_bill表中去,最主要的是字段名要一一对应,mark!