我有一個這樣的表v3_product_description
。搜索和替換MySQL:沒有被替換
+------------+-------------+-------------+--------------------------------------------------------------------+----------+--------------------------------------------------------------------+--------------------+------------+--+
| product_id | language_id | name | description | tag | meta_description | meta_keywords | meta_title | |
+------------+-------------+-------------+--------------------------------------------------------------------+----------+--------------------------------------------------------------------+--------------------+------------+--+
| 1 | 2 | Test | descrition about product. Altijd op voorraad. further description. | tag | descrition about product. Altijd op voorraad. further description. | keywords | title | |
| 2 | 1 | test | Beschrijving over het product | tagsss | metabeschrijving Altijd op voorraad | keywords,and so on | title | |
| 3 | 2 | Tessdslfkjq | product description | moretags | metadescription Altijd op voorraad | keywords,bullshit | titlestuff | |
+------------+-------------+-------------+--------------------------------------------------------------------+----------+--------------------------------------------------------------------+--------------------+------------+--+
正如你們所看到的短語Altijd op voorraad
是我的表中很常見的(我在真實的數據庫超過8000行)。
Altijd op voorraad
德語翻譯爲Immer auf Lager
德文的language_id
爲2
。
我試圖查找和替換這句話在我的表,所以我想出了這個查詢:
SELECT product_id, language_id, name, description, tag, meta_title, meta_description, meta_keyword,
REPLACE(meta_description,'Altijd op voorraad','Immer auf Lager')
FROM v3_product_description
WHERE language_id = 2
該查詢應meta_description
列改變每Altijd op voorraad
到Immer auf Lager
。但是一旦執行,當我在我的網上商店查看這些物品時,似乎沒有這樣做。
我在做什麼錯?以及如何應用相同的搜索/替換列description
?我應該使用第二個查詢來做到這一點,還是可以將這2個結合起來?
一個猜測是「特殊」字符。換句話說,也許元音有口音。 –
正如你在我給出的例子中看到的那樣,這些句子中沒有特殊字符,在替換函數中也沒有特殊字符。 – Baklap4
您只是在讀取列數據中進行替換。您需要執行UPDATE更改實際的表數據。 – jarlh