Advanced MySql Query: Update table with info from another table

前端 未结 3 1518
长发绾君心
长发绾君心 2020-11-29 02:40

I would like to update a table in mySql with data from another table.

I have two tables \"people\" and \"business\". The people table is linked to the business tabl

3条回答
  •  孤独总比滥情好
    2020-11-29 03:19

    Note, if sort_order is an INT, then don't use '1' - use 1:

    UPDATE business b
    JOIN People p
    ON p.business_id = b.business_id
    AND p.sort_order = '1'
    SET b.email = p.email
    WHERE b.email = '';
    

提交回复
热议问题