我是presto的新手,我想在一個特定的資料庫列上使用regex_replace而不是字串。 比如說。替換 "table1 "中所有以數字開頭、以空格結尾的 "描述 "列的條目
誰能幫我舉個例子?
誰能用一個例子來幫助我嗎?
我試著這樣做 :
從table1中選擇(regexp_replace(col("Description"), 'd s')) 但得到的錯誤。"Function not found", function "Col" is not registered.
提前感謝!
uj5u.com熱心網友回復:
只要把列名放進去就夠了,應該添加一個替換字串。所以,
col("Description") ->/span> Description
-> ,'replace_string'
最后的查詢應該是這樣的:
select regexp_replace(Description, 'd s'/span>,'replace_string'/span> ) from table1 b
uj5u.com熱心網友回復:
我認為這能滿足你的要求:
SELECT
REGEXP_REPLACE(`Description`, 'd s')
FROM `table1`。
在SQL中它們是可選的,但是你可以用反斜線來表示列名和表名,用撇號來表示字串。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/321957.html
標籤:
