如何在具有多个值的不同数据库中的2个表/不同列之间移动数据

时间:2013-05-25 00:56:26

标签: mysql sql database insert sql-insert

INSERT INTO a2.cat(id,img)SELECT category_id,category_id FROM topshop.category;

我需要在category_-id

的img列中插入加号值
INSERT INTO a2.cat (id, 'c'+img+'.jpg') SELECT category_id, category_id FROM topshop.category;

1 个答案:

答案 0 :(得分:1)

这里是:

INSERT INTO a2.cat 
  (id, img) 
SELECT 
  category_id, CONCAT('c',category_id,'.jpg')
FROM topshop.category;