UPDATE new_schedules_spider_static_schedule s join new_scac_port p on p.`PORT` = s.`PORT` and p.SCAC = 'aaa' set s.PORT_CODE = p.BASIC_CODE WHERE s.SCAC = 'aaa'