使用split_part(string text, delimiter text2, field int)以字元為辨別截取
其中:
-
- text 為截取字段
- text2 為截取辨別符:按照什麼形式切割(比如逗号’,’)
- int 為删除項目的位置:位置從1開始
舉例:查詢一個滿足條件的災害點圖檔
select image from geohazard_all_english where x = '110.31417' and y = '30.63582' and type = '地面沉降' and date = '201912'
由圖可知,查詢結果有多個,且通過
,
分割,是以使用
split_part
select split_part(image,',',1) as image from geohazard_all_english where x = '110.31417' and y = '30.63582' and type = '地面沉降' and date = '201912'