company contains id,company_name
company_alias contains id,company_id,company_alias
company_rawdata contains id,complaint descrption,company_match
我正在尝试使用company_name更新company_match,其中company descrption包含别名。
update company_rawdata cr inner join company c on c.company_name
like concat('',cr.complaint_descrption,'') set cr.matched_company = c.company_name
答案 0 :(得分:0)
UPDATE company_rawdata r
INNER JOIN company_alias a ON a.company_alias = r.description
INNER JOIN company c ON c.id = a.company_id
SET r.company_match = c.company_name
或者,如果a.company_alias
包含在a.company_alias
中的某个地方,则以下内容:
UPDATE company_rawdata r
INNER JOIN company_alias a ON a.company_alias LIKE CONCAT('%', r.description, '%')
INNER JOIN company c ON c.id = a.company_id
SET r.company_match = c.company_name
答案 1 :(得分:0)
试试:
UPDATE company c
INNER JOIN company_alias a ON a.company_id = c.id
INNER JOIN company_rawdata r ON a.company_alias = r.company_match
SET r.company_match = c.company_name