且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MYSQL将另一张表中的值插入一列

更新时间:2022-02-09 22:21:50

您可以在SELECT列列表中使用表达式.只要选择列表中的列和目标表中的列在数量和数据类型上都匹配,就可以执行以下操作:

You can use expressions in your SELECT column-list. As long as the columns in the select-list and the columns in the destination table match in number and data type, you can do something like this:

INSERT INTO items_rooms (item_id, room_id, x_dot_y, n)  
SELECT id, room_id, CONCAT(x,'.',y), z
  FROM `items_phoenix`