select CONCAT("update rd_employee_summary set ", IFNULL( (select CONCAT("security_station_id='",b.ITEM_ATTENDANCESITEID,"', security_station_name='",xx.ITEM_ATTENDANCESITENAME,"'") from baibaodunflow.tlk_attendance_site_person_info b join baibaodunflow.tlk_attendance_site_base_info xx on xx.ID=b.ITEM_ATTENDANCESITEID where b.ITEM_SECURITYID=t.tenant_employee_id limit 1), (select CONCAT("security_station_id='",b.ITEM_ATTENDANCESITEID,"', security_station_name='",xx.ITEM_ATTENDANCESITENAME,"'") from baibaodunflow.tlk_attendance_site_person_info b join baibaodunflow.tlk_attendance_site_base_info xx on xx.ID=b.ITEM_ATTENDANCESITEID limit 1) ), " where pk_id=",pk_id,";" ) from rd_employee_summary t where security_station_id is null limit 100; select CONCAT("update rd_employee_summary set idCard_no='", (select number from obpm2.tenant_user_credentials y where y.tenant_user_id=x.tenant_user_id and y.credential_type=0 limit 1),"' where pk_id=",pk_id,";") from rd_employee_summary x where idCard_no is null;