我有两张桌子好
hawker_master table
id hawker_name
1 raj
2 vicky
customer_entry table
hawkername
raj
raj
vicky
我需要从hawkermaster中选择特定hawker_name的id的sql查询,并在customer_entry表中更新id代替hawkername,如下所示..
FOR EX -
customer_entry table
hawkername
1
1
2
答案 0 :(得分:0)
您可以使用多表UPDATE
语法来执行连接:
UPDATE customer_entry ce
JOIN hawker_master hm ON hm.hawker_name = ce.hawkername
SET ce.hawkername = hm.id