2012-03-14 83 views
0

我有這個疑問:MySQL和幾個連接?

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 

現在,我wanto是與像value_id另一個值替換測試。在這種情況下,該列被稱爲。我將如何做到這一點?

謝謝!

回答

2

嘗試以下操作:

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%' 
+0

是啊,謝謝,這個工作! – EOB 2012-03-14 11:42:55

+0

我已編輯答案試一下... – Vikram 2012-03-14 11:45:01