我有这个查询:
SELECT concat('insert into catalog_category_entity_text (value) values(test) where value_id = ', value_id)
FROM catalog_category_entity_text
WHERE value LIKE '%category-slider%'
结果如下所示:
insert into catalog_category_entity_text (value) values(test) where value_id = 15
现在,我想要的是将 test 替换为另一个值,例如 value_id。在本例中,该列称为值。我该怎么做?
谢谢!
最佳答案
尝试以下操作:
SELECT concat('insert into catalog_category_entity_text (value) values(\'',value,'\') where value_id = ', value_id)
FROM catalog_category_entity_text
WHERE value LIKE '%category-slider%'
关于MySQL 和几个 concat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9701169/